org.clazzes.remoting.marshal.impl
Class MarshalerSupport

java.lang.Object
  extended by org.clazzes.remoting.marshal.impl.MarshalerSupport
All Implemented Interfaces:
Marshaler
Direct Known Subclasses:
CompactMarshaler, JAVAMarshaler

public abstract class MarshalerSupport
extends java.lang.Object
implements Marshaler


Constructor Summary
MarshalerSupport()
          Default constructor, which set the output and input buffer size to 0.
MarshalerSupport(int outputBufferSize, int inputBufferSize)
          Construct a JAVAMarshaler, with given input and output buffer sizes.
 
Method Summary
 int getInputBufferSize()
           
 int getOutputBufferSize()
           
protected  java.io.InputStream prepareInputStream(java.io.InputStream is)
          Prepare the transport input stream for use with ObjectInputStream.
protected  java.io.OutputStream prepareOutputStream(java.io.OutputStream os)
          Prepare the transport output stream for use with ObjectOutputStream.
 void setInputBufferSize(int inputBufferSize)
           
 void setOutputBufferSize(int outputBufferSize)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.clazzes.remoting.marshal.Marshaler
close, readObject, reset, setup, writeObject
 

Constructor Detail

MarshalerSupport

public MarshalerSupport()
Default constructor, which set the output and input buffer size to 0.


MarshalerSupport

public MarshalerSupport(int outputBufferSize,
                        int inputBufferSize)
Construct a JAVAMarshaler, with given input and output buffer sizes.

Parameters:
outputBufferSize - The size of the output buffer to use.
inputBufferSize - The size of the input buffer to use.
Method Detail

prepareOutputStream

protected java.io.OutputStream prepareOutputStream(java.io.OutputStream os)
                                            throws java.io.IOException
Prepare the transport output stream for use with ObjectOutputStream. This may involve wrapping the stream with a BufferedInputStream or some other sort of FilterInputStream like CipherInputStream or GZIPOutputStream. The default implementation wraps the output stream with BufferedInputStream, if the output buffer size is set to a positive value.

Parameters:
os - The raw OutputStream as passed to Marshaler.setup(OutputStream, InputStream, ClassLoader).
Returns:
A wrapped output stream.
Throws:
java.io.IOException - Upon errors setting up the stream.

prepareInputStream

protected java.io.InputStream prepareInputStream(java.io.InputStream is)
                                          throws java.io.IOException
Prepare the transport input stream for use with ObjectInputStream. This may involve wrapping the stream with a BufferedOutputStream or some other sort of FilterOutputStream like CipherOutputStream or GZIPOutputStream. The default implementation wraps the input stream with BufferedOutputStream, if the input buffer size is set to a positive value.

Parameters:
is - The raw InputStream as passed to Marshaler.setup(OutputStream, InputStream, ClassLoader).
Returns:
A wrapped InputStream.
Throws:
java.io.IOException

getOutputBufferSize

public int getOutputBufferSize()
Returns:
The buffer size to use for the BufferedOutputStream used. If set to 0, no output buffering is performed.

setOutputBufferSize

public void setOutputBufferSize(int outputBufferSize)
Parameters:
outputBufferSize - The output buffer size to set.

getInputBufferSize

public int getInputBufferSize()
Returns:
The buffer size to use for the BufferedInputStream used. If set to 0, no input buffering is performed.

setInputBufferSize

public void setInputBufferSize(int inputBufferSize)
Parameters:
inputBufferSize - The input buffer size to set.


Copyright © 2010. All Rights Reserved.