com.healthmarketscience.rmiio.util
Class OutputStreamAdapter

java.lang.Object
  extended by com.healthmarketscience.rmiio.util.OutputStreamAdapter

public abstract class OutputStreamAdapter
extends Object

Utility class for optimizing different write strategies based on the type of the underlying OutputStream.

Author:
James Ahlborn

Method Summary
static OutputStreamAdapter create(OutputStream istream)
           
abstract  OutputStream getOutputStream()
           
abstract  void writePacket(byte[] packet)
          Puts the given "packet" into the output stream.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getOutputStream

public abstract OutputStream getOutputStream()
Returns:
the underlying OutputStream

writePacket

public abstract void writePacket(byte[] packet)
                          throws IOException
Puts the given "packet" into the output stream. The packet should be filled with data. The caller is giving control of the buffer to the PacketOutputStream, and therefore should not attempt to use the byte[] again.

Parameters:
packet - fully filled array of bytes to give to the OutputStream
Throws:
IOException

create

public static OutputStreamAdapter create(OutputStream istream)
Parameters:
istream - stream to wrap and for which the implementation is optimized
Returns:
an OutputStreamAdapter optimized for the stream type


Copyright © 2006–2016 Health Market Science. All rights reserved.