Package com.tangosol.io
Class WrapperDataOutputStream
- java.lang.Object
- 
- java.io.OutputStream
- 
- com.tangosol.io.WrapperDataOutputStream
 
 
- 
- All Implemented Interfaces:
- com.oracle.coherence.common.io.OutputStreaming,- OutputStreaming,- Closeable,- DataOutput,- Flushable,- AutoCloseable
 - Direct Known Subclasses:
- ExternalizableHelper.ShieldedDataOutputStream,- WrapperObjectOutputStream
 
 public class WrapperDataOutputStream extends OutputStream implements DataOutput, OutputStreaming This is an imitation DataOutputStream class that provides the DataOutput interface by delegating to an object that implements the DataOutput interface. Primarily, this is intended as a base class for building specific-purpose DataOutput wrappers.- Author:
- cp 2004.08.20
 
- 
- 
Constructor SummaryConstructors Constructor Description WrapperDataOutputStream(DataOutput out)Construct a WrapperDataOutputStream that will output to the specified object implementing the DataOutput interface.
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Closes this OutputStream and releases any associated system resources.voidflush()Flushes this OutputStream and forces any buffered output bytes to be written.longgetBytesWritten()Return the total number of bytes written to the wrapped DataOutput object.DataOutputgetDataOutput()Obtain the underlying object providing the DataOutput interface that this object is delegating to.protected voidincBytesWritten(int cb)Increment the count of total number of bytes written to the wrapped DataOutput object by the specified number of bytes.voidwrite(byte[] ab)Writes all the bytes in the arrayab.voidwrite(byte[] ab, int of, int cb)Writescbbytes starting at offsetoffrom the arrayab.voidwrite(int b)Writes the eight low-order bits of the argumentb.voidwriteBoolean(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.voidwriteUTF(String s)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.- 
Methods inherited from class java.io.OutputStreamnullOutputStream
 
- 
 
- 
- 
- 
Constructor Detail- 
WrapperDataOutputStreampublic WrapperDataOutputStream(DataOutput out) Construct a WrapperDataOutputStream that will output to the specified object implementing the DataOutput interface.- Parameters:
- out- an object implementing DataOutput to write to
 
 
- 
 - 
Method Detail- 
getDataOutputpublic DataOutput getDataOutput() Obtain the underlying object providing the DataOutput interface that this object is delegating to.- Returns:
- the underlying DataOutput
 
 - 
getBytesWrittenpublic long getBytesWritten() Return the total number of bytes written to the wrapped DataOutput object.- Returns:
- the total number of bytes written
 
 - 
incBytesWrittenprotected void incBytesWritten(int cb) Increment the count of total number of bytes written to the wrapped DataOutput object by the specified number of bytes.If the count has reached Long.MAX_VALUE, the count is not incremented. - Parameters:
- cb- the number of bytes to increment the count by
 
 - 
writepublic void write(int b) throws IOExceptionWrites the eight low-order bits of the argumentb. The 24 high-order bits ofbare ignored.- Specified by:
- writein interface- DataOutput
- Specified by:
- writein interface- com.oracle.coherence.common.io.OutputStreaming
- Specified by:
- writein class- OutputStream
- Parameters:
- b- the byte to write (passed as an integer)
- Throws:
- IOException- if an I/O error occurs
 
 - 
writepublic void write(byte[] ab) throws IOExceptionWrites all the bytes in the arrayab.- Specified by:
- writein interface- DataOutput
- Specified by:
- writein interface- com.oracle.coherence.common.io.OutputStreaming
- Overrides:
- writein class- OutputStream
- Parameters:
- ab- the byte array to write
- Throws:
- IOException- if an I/O error occurs
- NullPointerException- if- abis- null
 
 - 
writepublic void write(byte[] ab, int of, int cb) throws IOExceptionWritescbbytes starting at offsetoffrom the arrayab.- Specified by:
- writein interface- DataOutput
- Specified by:
- writein interface- com.oracle.coherence.common.io.OutputStreaming
- Overrides:
- writein class- OutputStream
- Parameters:
- ab- the byte array to write from
- of- the offset into- abto start writing from
- cb- the number of bytes from- abto write
- Throws:
- IOException- if an I/O error occurs
- NullPointerException- if- abis- null
- IndexOutOfBoundsException- if- ofis negative, or- cbis negative, or- of+cbis greater than- ab.length
 
 - 
writeBooleanpublic void writeBoolean(boolean f) throws IOExceptionWrites the boolean valuef.- Specified by:
- writeBooleanin interface- DataOutput
- Parameters:
- f- the boolean to be written
- Throws:
- IOException- if an I/O error occurs
 
 - 
writeBytepublic void writeByte(int b) throws IOExceptionWrites the eight low-order bits of the argumentb. The 24 high-order bits ofbare ignored.- Specified by:
- writeBytein interface- DataOutput
- Parameters:
- b- the byte to write (passed as an integer)
- Throws:
- IOException- if an I/O error occurs
 
 - 
writeShortpublic void writeShort(int n) throws IOExceptionWrites a short value, comprised of the 16 low-order bits of the argumentn; the 16 high-order bits ofnare ignored.- Specified by:
- writeShortin interface- DataOutput
- Parameters:
- n- the short to write (passed as an integer)
- Throws:
- IOException- if an I/O error occurs
 
 - 
writeCharpublic void writeChar(int ch) throws IOExceptionWrites a char value, comprised of the 16 low-order bits of the argumentch; the 16 high-order bits ofchare ignored.- Specified by:
- writeCharin interface- DataOutput
- Parameters:
- ch- the char to write (passed as an integer)
- Throws:
- IOException- if an I/O error occurs
 
 - 
writeIntpublic void writeInt(int n) throws IOExceptionWrites an int value.- Specified by:
- writeIntin interface- DataOutput
- Parameters:
- n- the int to write
- Throws:
- IOException- if an I/O error occurs
 
 - 
writeLongpublic void writeLong(long l) throws IOExceptionWrites a long value.- Specified by:
- writeLongin interface- DataOutput
- Parameters:
- l- the long to write
- Throws:
- IOException- if an I/O error occurs
 
 - 
writeFloatpublic void writeFloat(float fl) throws IOExceptionWrites a float value.- Specified by:
- writeFloatin interface- DataOutput
- Parameters:
- fl- the float to write
- Throws:
- IOException- if an I/O error occurs
 
 - 
writeDoublepublic void writeDouble(double dfl) throws IOExceptionWrites a double value.- Specified by:
- writeDoublein interface- DataOutput
- Parameters:
- dfl- the double to write
- Throws:
- IOException- if an I/O error occurs
 
 - 
writeBytespublic void writeBytes(String s) throws IOException Writes the Strings, but only the low-order byte from each character of the String is written.- Specified by:
- writeBytesin interface- DataOutput
- Parameters:
- s- the String to write
- Throws:
- IOException- if an I/O error occurs
- NullPointerException- if- sis- null
 
 - 
writeCharspublic void writeChars(String s) throws IOException Writes the Stringsas a sequence of characters.- Specified by:
- writeCharsin interface- DataOutput
- Parameters:
- s- the String to write
- Throws:
- IOException- if an I/O error occurs
- NullPointerException- if- sis- null
 
 - 
writeUTFpublic void writeUTF(String s) throws IOException 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 interface- DataOutput
- Parameters:
- s- the String to write
- Throws:
- IOException- if an I/O error occurs
- NullPointerException- if- sis- null
 
 - 
flushpublic void flush() throws IOExceptionFlushes this OutputStream and forces any buffered output bytes to be written.- Specified by:
- flushin interface- Flushable
- Specified by:
- flushin interface- com.oracle.coherence.common.io.OutputStreaming
- Overrides:
- flushin class- OutputStream
- Throws:
- IOException- if an I/O error occurs
 
 - 
closepublic void close() throws IOExceptionCloses this OutputStream and releases any associated system resources.- Specified by:
- closein interface- AutoCloseable
- Specified by:
- closein interface- Closeable
- Specified by:
- closein interface- com.oracle.coherence.common.io.OutputStreaming
- Overrides:
- closein class- OutputStream
- Throws:
- IOException- if an I/O error occurs
 
 
- 
 
-