org.openorb.orb.net
Class BufferingSocketStreamDecorationStrategy

java.lang.Object
  extended byorg.openorb.orb.net.BufferingSocketStreamDecorationStrategy
All Implemented Interfaces:
SocketStreamDecorationStrategy

public final class BufferingSocketStreamDecorationStrategy
extends java.lang.Object
implements SocketStreamDecorationStrategy

A strategy for buffering socket streams

Version:
$Revision: 1.1 $ $Date: 2004/05/14 00:36:25 $
Author:
Richard G Clark

Nested Class Summary
static class BufferingSocketStreamDecorationStrategy.Factory
          Factory for creating instances of BufferingSocketStreamDecorationStrategy.
 
Constructor Summary
BufferingSocketStreamDecorationStrategy(int inputBufferSize, int outputBufferSize)
          Constructs a decoration strategy using the specified buffer sizes.
 
Method Summary
 java.io.InputStream decorate(java.net.Socket socket, java.io.InputStream stream)
          Creates a decorated InputStream.
 java.io.OutputStream decorate(java.net.Socket socket, java.io.OutputStream stream)
          Creates a decorated OutputStream.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BufferingSocketStreamDecorationStrategy

public BufferingSocketStreamDecorationStrategy(int inputBufferSize,
                                               int outputBufferSize)
Constructs a decoration strategy using the specified buffer sizes. Buffer sizes less than or equal to zero indicate that no buffer is required,

Parameters:
inputBufferSize - the size of input buffer to be used
outputBufferSize - the size of the output buffer to be used
Method Detail

decorate

public java.io.InputStream decorate(java.net.Socket socket,
                                    java.io.InputStream stream)
                             throws java.io.IOException
Creates a decorated InputStream.

Specified by:
decorate in interface SocketStreamDecorationStrategy
Parameters:
socket - the source of the original stream
stream - the stream to be decorated
Returns:
a decorated InputStream.
Throws:
java.io.IOException - if an I/O error occurs while creating the socket.

decorate

public java.io.OutputStream decorate(java.net.Socket socket,
                                     java.io.OutputStream stream)
                              throws java.io.IOException
Creates a decorated OutputStream.

Specified by:
decorate in interface SocketStreamDecorationStrategy
Parameters:
socket - the source of the original stream
stream - the stream to be decorated
Returns:
a decorated OutputStream.
Throws:
java.io.IOException - if an I/O error occurs while creating the socket.