Package com.tangosol.io
Class PackedDataOutputStream
java.lang.Object
java.io.OutputStream
com.tangosol.io.WrapperOutputStream
com.tangosol.io.PackedDataOutputStream
- All Implemented Interfaces:
com.oracle.coherence.common.io.OutputStreaming,OutputStreaming,Closeable,DataOutput,Flushable,AutoCloseable
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
ConstructorsConstructorDescriptionConstruct a PackedDataOutputStream that will output to the specified OutputStream object. -
Method Summary
Modifier and TypeMethodDescriptionvoidwriteBoolean(boolean f) Writes the boolean valuef.voidwriteByte(int b) Writes the eight low-order bits of the argumentb.voidwriteBytes(String s) Writes the Strings, but only the low-order byte from each character of the String is written.voidwriteChar(int ch) Writes a char value, comprised of the 16 low-order bits of the argumentch; the 16 high-order bits ofchare ignored.voidwriteChars(String s) Writes the Stringsas a sequence of characters.voidwriteDouble(double dfl) Writes a double value.voidwriteFloat(float fl) Writes a float value.voidwriteInt(int n) Writes an int value.voidwriteLong(long l) Writes a long value.voidwriteShort(int n) Writes a short value, comprised of the 16 low-order bits of the argumentn; the 16 high-order bits ofnare ignored.voidWrites the Stringsas a sequence of characters, but using UTF-8 encoding for the characters, and including the String length data so that the correspondingDataInput.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, writeMethods inherited from class java.io.OutputStream
nullOutputStreamMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.io.DataOutput
write, write, write
-
Constructor Details
-
PackedDataOutputStream
Construct a PackedDataOutputStream that will output to the specified OutputStream object.- Parameters:
out- an OutputStream to write to
-
-
Method Details
-
writeBoolean
Writes the boolean valuef.- Specified by:
writeBooleanin interfaceDataOutput- Parameters:
f- the boolean to be written- Throws:
IOException- if an I/O error occurs
-
writeByte
Writes the eight low-order bits of the argumentb. The 24 high-order bits ofbare ignored.- Specified by:
writeBytein interfaceDataOutput- Parameters:
b- the byte to write (passed as an integer)- Throws:
IOException- if an I/O error occurs
-
writeShort
Writes a short value, comprised of the 16 low-order bits of the argumentn; the 16 high-order bits ofnare ignored.- Specified by:
writeShortin interfaceDataOutput- Parameters:
n- the short to write (passed as an integer)- Throws:
IOException- if an I/O error occurs
-
writeChar
Writes a char value, comprised of the 16 low-order bits of the argumentch; the 16 high-order bits ofchare ignored.- Specified by:
writeCharin interfaceDataOutput- Parameters:
ch- the char to write (passed as an integer)- Throws:
IOException- if an I/O error occurs
-
writeInt
Writes an int value.- Specified by:
writeIntin interfaceDataOutput- Parameters:
n- the int to write- Throws:
IOException- if an I/O error occurs
-
writeLong
Writes a long value.- Specified by:
writeLongin interfaceDataOutput- Parameters:
l- the long to write- Throws:
IOException- if an I/O error occurs
-
writeFloat
Writes a float value.- Specified by:
writeFloatin interfaceDataOutput- Parameters:
fl- the float to write- Throws:
IOException- if an I/O error occurs
-
writeDouble
Writes a double value.- Specified by:
writeDoublein interfaceDataOutput- Parameters:
dfl- the double to write- Throws:
IOException- if an I/O error occurs
-
writeBytes
Writes the Strings, but only the low-order byte from each character of the String is written.- Specified by:
writeBytesin interfaceDataOutput- Parameters:
s- the String to write- Throws:
IOException- if an I/O error occursNullPointerException- ifsisnull
-
writeChars
Writes the Stringsas a sequence of characters.- Specified by:
writeCharsin interfaceDataOutput- Parameters:
s- the String to write- Throws:
IOException- if an I/O error occursNullPointerException- ifsisnull
-
writeUTF
Writes the Stringsas a sequence of characters, but using UTF-8 encoding for the characters, and including the String length data so that the correspondingDataInput.readUTF()method can reconstitute a String from the written data.- Specified by:
writeUTFin interfaceDataOutput- Parameters:
s- the String to write- Throws:
IOException- if an I/O error occursNullPointerException- ifsisnull
-