com.healthmarketscience.rmiio
Class SerializableOutputStream

java.lang.Object
  extended by java.io.OutputStream
      extended by com.healthmarketscience.rmiio.SerializableOutputStream
All Implemented Interfaces:
RemoteClient, Closeable, Flushable, Serializable

public class SerializableOutputStream
extends OutputStream
implements Serializable, RemoteClient

An additional layer around a RemoteOutputStream which makes it Serializable and an OutputStream. In general, this extra layer is not necessary and I do not recommend using this class. However, in the odd case where the callee really wants to get something which is already an OutputStream, this class can be useful. This is basically just a wrapper around a call to RemoteOutputStreamClient.wrap(com.healthmarketscience.rmiio.RemoteOutputStream).

Author:
James Ahlborn
See Also:
Usage Notes, Serialized Form

Field Summary
 
Fields inherited from interface com.healthmarketscience.rmiio.RemoteClient
DEFAULT_RETRY
 
Constructor Summary
SerializableOutputStream(OutputStream localIn)
           
SerializableOutputStream(RemoteOutputStream remoteOut)
           
 
Method Summary
 void close()
           
 void flush()
           
 void setChunkSize(Integer chunkSize)
          May be called on the client-side in order to set the target chunk size used by the underlying implementation.
 void setRemoteRetry(RemoteRetry retry)
          Sets the client side RemoteRetry policy to use for the underlying remote communication layer.
 void write(byte[] b)
           
 void write(byte[] b, int off, int len)
           
 void write(int b)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SerializableOutputStream

public SerializableOutputStream(OutputStream localIn)

SerializableOutputStream

public SerializableOutputStream(RemoteOutputStream remoteOut)
Method Detail

setRemoteRetry

public void setRemoteRetry(RemoteRetry retry)
Description copied from interface: RemoteClient
Sets the client side RemoteRetry policy to use for the underlying remote communication layer. For most client side implementations, this method must be called before any other calls on this client object (any calls to this method after one of those methods is called will have no affect).

Specified by:
setRemoteRetry in interface RemoteClient
Parameters:
retry - the new RemoteRetry policy to use for remote communication. null causes the RemoteClient.DEFAULT_RETRY policy to be used.

setChunkSize

public void setChunkSize(Integer chunkSize)
May be called on the client-side in order to set the target chunk size used by the underlying implementation. Must be called prior to any stream method call, as once the underlying stream is initialized, the chunk size cannot be changed.

Parameters:
chunkSize - target value for the byte size of the packets of data sent over the wire. note that this is a suggestion, actual packet sizes may vary. if null, RemoteOutputStreamClient.DEFAULT_CHUNK_SIZE will be used.

flush

public void flush()
           throws IOException
Specified by:
flush in interface Flushable
Overrides:
flush in class OutputStream
Throws:
IOException

write

public void write(int b)
           throws IOException
Specified by:
write in class OutputStream
Throws:
IOException

write

public void write(byte[] b)
           throws IOException
Overrides:
write in class OutputStream
Throws:
IOException

write

public void write(byte[] b,
                  int off,
                  int len)
           throws IOException
Overrides:
write in class OutputStream
Throws:
IOException

close

public void close()
           throws IOException
Specified by:
close in interface Closeable
Overrides:
close in class OutputStream
Throws:
IOException


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