Skip navigation links

Oracle® Coherence Java API Reference
v3.5.1

E15583-01


com.tangosol.io
Class WrapperOutputStream

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

All Implemented Interfaces:
OutputStreaming, java.io.Closeable, java.io.Flushable
Direct Known Subclasses:
AsymmetricEncryptionFilter.IdentityOutputStream, ClusterEncryptionFilter.MultiplexingOutputStream, PackedDataOutputStream

public class WrapperOutputStream
extends java.io.OutputStream
implements OutputStreaming

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
protected  java.io.OutputStream m_out
          The underlying OutputStream object to use.

 

Constructor Summary
WrapperOutputStream()
          Construct an uninitialized WrapperOutputStream.
WrapperOutputStream(java.io.OutputStream out)
          Construct a WrapperOutputStream that will output to the specified OutputStream object.

 

Method Summary
 void close()
          Closes this OutputStream and releases any associated system resources.
protected  java.io.OutputStream ensureOutputStream()
          Return the underlying OutputStream.
 void flush()
          Flushes this OutputStream and forces any buffered output bytes to be written.
 java.io.OutputStream getOutputStream()
          Obtain the underlying OutputStream.
 void setOutputStream(java.io.OutputStream out)
          Specify the underlying OutputStream.
 void write(byte[] ab)
          Writes all the bytes in the array ab.
 void write(byte[] ab, int of, int cb)
          Writes cb bytes starting at offset of from the array ab.
 void write(int b)
          Writes the eight low-order bits of the argument b.

 

Field Detail

m_out

protected java.io.OutputStream m_out
The underlying OutputStream object to use.

Constructor Detail

WrapperOutputStream

public WrapperOutputStream()
Construct an uninitialized WrapperOutputStream.

WrapperOutputStream

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

Method Detail

getOutputStream

public java.io.OutputStream getOutputStream()
Obtain the underlying OutputStream.
Returns:
the underlying OutputStream

ensureOutputStream

protected java.io.OutputStream ensureOutputStream()
Return the underlying OutputStream.
Returns:
the underlying OutputStream
Throws:
java.lang.IllegalStateException - if the underlying stream has not been specified.

setOutputStream

public void setOutputStream(java.io.OutputStream out)
Specify the underlying OutputStream. This method may only be called once with a non-null value.
Parameters:
out - the stream to be wrapped
Throws:
java.lang.IllegalStateException - if the underlying stream has already been specified.

write

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

write

public void write(byte[] ab)
           throws java.io.IOException
Writes all the bytes in the array ab.
Specified by:
write in interface OutputStreaming
Overrides:
write in class java.io.OutputStream
Parameters:
ab - the byte array to write
Throws:
java.io.IOException - if an I/O error occurs
java.lang.NullPointerException - if ab is null

write

public void write(byte[] ab,
                  int of,
                  int cb)
           throws java.io.IOException
Writes cb bytes starting at offset of from the array ab.
Specified by:
write in interface OutputStreaming
Overrides:
write in class java.io.OutputStream
Parameters:
ab - the byte array to write from
of - the offset into ab to start writing from
cb - the number of bytes from ab to write
Throws:
java.io.IOException - if an I/O error occurs
java.lang.NullPointerException - if ab is null
java.lang.IndexOutOfBoundsException - if of is negative, or cb is negative, or of+cb is greater than ab.length

flush

public void flush()
           throws java.io.IOException
Flushes this OutputStream and forces any buffered output bytes to be written.
Specified by:
flush in interface OutputStreaming
Specified by:
flush in interface java.io.Flushable
Overrides:
flush in class java.io.OutputStream
Throws:
java.io.IOException - if an I/O error occurs

close

public void close()
           throws java.io.IOException
Closes this OutputStream and releases any associated system resources.
Specified by:
close in interface OutputStreaming
Specified by:
close in interface java.io.Closeable
Overrides:
close in class java.io.OutputStream
Throws:
java.io.IOException - if an I/O error occurs

Skip navigation links

Oracle® Coherence Java API Reference
v3.5.1

E15583-01


Copyright © 2000, 2009, Oracle. All rights reserved.