Skip navigation links

Oracle® Coherence Java API Reference
Release 3.6.0.0

E15725-01


com.tangosol.io
Class PackedDataOutputStream

java.lang.Object
  extended by java.io.OutputStream
      extended by com.tangosol.io.WrapperOutputStream
          extended by com.tangosol.io.PackedDataOutputStream

All Implemented Interfaces:
OutputStreaming, Closeable, DataOutput, Flushable

public class PackedDataOutputStream
extends WrapperOutputStream
implements DataOutput

This is an imitation DataOutputStream class that packs its data tighter using variable-length integers and supports UTF longer than 64KB.

Warning! This class is not intended to be thread-safe!

Author:
cp 2004.09.09

Field Summary

 

Fields inherited from class com.tangosol.io.WrapperOutputStream
m_out

 

Constructor Summary
PackedDataOutputStream(OutputStream out)
          Construct a PackedDataOutputStream that will output to the specified OutputStream object.

 

Method Summary
 void writeBoolean(boolean f)
          Writes the boolean value f.
 void writeByte(int b)
          Writes the eight low-order bits of the argument b.
 void writeBytes(String s)
          Writes the String s, but only the low-order byte from each character of the String is written.
 void writeChar(int ch)
          Writes a char value, comprised of the 16 low-order bits of the argument ch; the 16 high-order bits of ch are ignored.
 void writeChars(String s)
          Writes the String s as a sequence of characters.
 void writeDouble(double dfl)
          Writes a double value.
 void writeFloat(float fl)
          Writes a float value.
 void writeInt(int n)
          Writes an int value.
 void writeLong(long l)
          Writes a long value.
 void writeShort(int n)
          Writes a short value, comprised of the 16 low-order bits of the argument n; the 16 high-order bits of n are ignored.
 void writeUTF(String s)
          Writes the String s as a sequence of characters, but using UTF-8 encoding for the characters, and including the String length data so that the corresponding DataInput.readUTF() method can reconstitute a String from the written data.

 

Methods inherited from class com.tangosol.io.WrapperOutputStream
close, ensureOutputStream, flush, getOutputStream, setOutputStream, write, write, write

 

Methods inherited from interface java.io.DataOutput
write, write, write

 

Constructor Detail

PackedDataOutputStream

public PackedDataOutputStream(OutputStream out)
Construct a PackedDataOutputStream that will output to the specified OutputStream object.
Parameters:
out - an OutputStream to write to

Method Detail

writeBoolean

public void writeBoolean(boolean f)
                  throws IOException
Writes the boolean value f.
Specified by:
writeBoolean in interface DataOutput
Parameters:
f - the boolean to be written
Throws:
IOException - if an I/O error occurs

writeByte

public void writeByte(int b)
               throws IOException
Writes the eight low-order bits of the argument b. The 24 high-order bits of b are ignored.
Specified by:
writeByte in interface DataOutput
Parameters:
b - the byte to write (passed as an integer)
Throws:
IOException - if an I/O error occurs

writeShort

public void writeShort(int n)
                throws IOException
Writes a short value, comprised of the 16 low-order bits of the argument n; the 16 high-order bits of n are ignored.
Specified by:
writeShort in interface DataOutput
Parameters:
n - the short to write (passed as an integer)
Throws:
IOException - if an I/O error occurs

writeChar

public void writeChar(int ch)
               throws IOException
Writes a char value, comprised of the 16 low-order bits of the argument ch; the 16 high-order bits of ch are ignored.
Specified by:
writeChar in interface DataOutput
Parameters:
ch - the char to write (passed as an integer)
Throws:
IOException - if an I/O error occurs

writeInt

public void writeInt(int n)
              throws IOException
Writes an int value.
Specified by:
writeInt in interface DataOutput
Parameters:
n - the int to write
Throws:
IOException - if an I/O error occurs

writeLong

public void writeLong(long l)
               throws IOException
Writes a long value.
Specified by:
writeLong in interface DataOutput
Parameters:
l - the long to write
Throws:
IOException - if an I/O error occurs

writeFloat

public void writeFloat(float fl)
                throws IOException
Writes a float value.
Specified by:
writeFloat in interface DataOutput
Parameters:
fl - the float to write
Throws:
IOException - if an I/O error occurs

writeDouble

public void writeDouble(double dfl)
                 throws IOException
Writes a double value.
Specified by:
writeDouble in interface DataOutput
Parameters:
dfl - the double to write
Throws:
IOException - if an I/O error occurs

writeBytes

public void writeBytes(String s)
                throws IOException
Writes the String s, but only the low-order byte from each character of the String is written.
Specified by:
writeBytes in interface DataOutput
Parameters:
s - the String to write
Throws:
IOException - if an I/O error occurs
NullPointerException - if s is null

writeChars

public void writeChars(String s)
                throws IOException
Writes the String s as a sequence of characters.
Specified by:
writeChars in interface DataOutput
Parameters:
s - the String to write
Throws:
IOException - if an I/O error occurs
NullPointerException - if s is null

writeUTF

public void writeUTF(String s)
              throws IOException
Writes the String s as a sequence of characters, but using UTF-8 encoding for the characters, and including the String length data so that the corresponding DataInput.readUTF() method can reconstitute a String from the written data.
Specified by:
writeUTF in interface DataOutput
Parameters:
s - the String to write
Throws:
IOException - if an I/O error occurs
NullPointerException - if s is null

Skip navigation links

Oracle® Coherence Java API Reference
Release 3.6.0.0

E15725-01


Copyright © 2000, 2010, Oracle and/or its affiliates. All rights reserved.