Package com.tangosol.io
Class WrapperOutputStream
java.lang.Object
java.io.OutputStream
com.tangosol.io.WrapperOutputStream
- All Implemented Interfaces:
com.oracle.coherence.common.io.OutputStreaming
,OutputStreaming
,Closeable
,Flushable
,AutoCloseable
- Direct Known Subclasses:
ExternalizableHelper.ShieldedOutputStream
,PackedDataOutputStream
This is an OutputStream class that delegates to another OutputStream.
Primarily, this is intended as a base class for building specific-purpose
OutputStream wrappers.
- Author:
- cp 2004.08.20
-
Field Summary
Modifier and TypeFieldDescriptionprotected OutputStream
The underlying OutputStream object to use. -
Constructor Summary
ConstructorDescriptionConstruct an uninitialized WrapperOutputStream.Construct a WrapperOutputStream that will output to the specified OutputStream object. -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
Closes this OutputStream and releases any associated system resources.protected OutputStream
Return the underlying OutputStream.void
flush()
Flushes this OutputStream and forces any buffered output bytes to be written.Obtain the underlying OutputStream.void
Specify the underlying OutputStream.void
write
(byte[] ab) Writes all the bytes in the arrayab
.void
write
(byte[] ab, int of, int cb) Writescb
bytes starting at offsetof
from the arrayab
.void
write
(int b) Writes the eight low-order bits of the argumentb
.Methods inherited from class java.io.OutputStream
nullOutputStream
-
Field Details
-
m_out
The underlying OutputStream object to use.
-
-
Constructor Details
-
WrapperOutputStream
public WrapperOutputStream()Construct an uninitialized WrapperOutputStream. -
WrapperOutputStream
Construct a WrapperOutputStream that will output to the specified OutputStream object.- Parameters:
out
- an OutputStream object to write to
-
-
Method Details
-
getOutputStream
Obtain the underlying OutputStream.- Returns:
- the underlying OutputStream
-
ensureOutputStream
Return the underlying OutputStream.- Returns:
- the underlying OutputStream
- Throws:
IllegalStateException
- if the underlying stream has not been specified.
-
setOutputStream
Specify the underlying OutputStream. This method may only be called once with a non-null value.- Parameters:
out
- the stream to be wrapped- Throws:
IllegalStateException
- if the underlying stream has already been specified.
-
write
Writes the eight low-order bits of the argumentb
. The 24 high-order bits ofb
are ignored.- Specified by:
write
in interfacecom.oracle.coherence.common.io.OutputStreaming
- Specified by:
write
in classOutputStream
- Parameters:
b
- the byte to write (passed as an integer)- Throws:
IOException
- if an I/O error occurs
-
write
Writes all the bytes in the arrayab
.- Specified by:
write
in interfacecom.oracle.coherence.common.io.OutputStreaming
- Overrides:
write
in classOutputStream
- Parameters:
ab
- the byte array to write- Throws:
IOException
- if an I/O error occursNullPointerException
- ifab
isnull
-
write
Writescb
bytes starting at offsetof
from the arrayab
.- Specified by:
write
in interfacecom.oracle.coherence.common.io.OutputStreaming
- Overrides:
write
in classOutputStream
- Parameters:
ab
- the byte array to write fromof
- the offset intoab
to start writing fromcb
- the number of bytes fromab
to write- Throws:
IOException
- if an I/O error occursNullPointerException
- ifab
isnull
IndexOutOfBoundsException
- ifof
is negative, orcb
is negative, orof+cb
is greater thanab.length
-
flush
Flushes this OutputStream and forces any buffered output bytes to be written.- Specified by:
flush
in interfaceFlushable
- Specified by:
flush
in interfacecom.oracle.coherence.common.io.OutputStreaming
- Overrides:
flush
in classOutputStream
- Throws:
IOException
- if an I/O error occurs
-
close
Closes this OutputStream and releases any associated system resources.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Specified by:
close
in interfacecom.oracle.coherence.common.io.OutputStreaming
- Overrides:
close
in classOutputStream
- Throws:
IOException
- if an I/O error occurs
-