org.openorb.orb.net
Class CompositeSocketStreamDecorationStrategy

java.lang.Object
  extended by org.openorb.orb.net.CompositeSocketStreamDecorationStrategy
All Implemented Interfaces:
SocketStreamDecorationStrategy

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

A strategy for decorating sockets streams using 2 other strategies in sequence.

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

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.openorb.orb.net.SocketStreamDecorationStrategy
SocketStreamDecorationStrategy.Factory
 
Constructor Summary
CompositeSocketStreamDecorationStrategy(SocketStreamDecorationStrategy strategy1, SocketStreamDecorationStrategy strategy2)
          Constructs a composite strategy from two other strategies.
 
Method Summary
 java.io.InputStream decorate(java.net.Socket socket, java.io.InputStream stream)
          Creates a decorated InputStream, by first applying decoration strategy1 then applying strategy2 to the resulting stream.
 java.io.OutputStream decorate(java.net.Socket socket, java.io.OutputStream stream)
          Creates a decorated InputStream, by first applying decoration strategy1 then applying strategy2 to the resulting stream.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CompositeSocketStreamDecorationStrategy

public CompositeSocketStreamDecorationStrategy(SocketStreamDecorationStrategy strategy1,
                                               SocketStreamDecorationStrategy strategy2)
Constructs a composite strategy from two other strategies.

Parameters:
strategy1 - the first strategy to apply
strategy2 - the second strategy to apply
Method Detail

decorate

public java.io.InputStream decorate(java.net.Socket socket,
                                    java.io.InputStream stream)
                             throws java.io.IOException
Creates a decorated InputStream, by first applying decoration strategy1 then applying strategy2 to the resulting stream.

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 InputStream, by first applying decoration strategy1 then applying strategy2 to the resulting stream.

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.