org.jboss.remoting.transport.multiplex.utility
Class GrowablePipedOutputStream

java.lang.Object
  extended by java.io.OutputStream
      extended by org.jboss.remoting.transport.multiplex.utility.GrowablePipedOutputStream
All Implemented Interfaces:
java.io.Closeable, java.io.Flushable

public class GrowablePipedOutputStream
extends java.io.OutputStream

GrowablePipedOutputStream works together with GrowablePipedInputStream like java.io.PipedInputStream and java.io.PipedOutputStream work together, so that calling GrowablePipedOutputStream.write() causes bytes to be deposited with the matching GrowablePipedInputStream. However, unlike PipedInputStream, GrowablePipedInputStream stores bytes in a ShrinkableByteArrayOutputStream, which can grow and contract dynamically in response to the number of bytes it contains.

For more information about method behavior, see the java.io.OutputStream javadoc.

Version:
$Revision: 1248 $

Copyright (c) 2005

Author:
Ron Sigal

Constructor Summary
GrowablePipedOutputStream()
          Create a new GrowablePipedOutputStream.
GrowablePipedOutputStream(GrowablePipedInputStream sink)
          Create a new GrowablePipedOutputStream.
 
Method Summary
protected  void connect(GrowablePipedInputStream sink)
           
protected  boolean isConnected()
           
 void write(byte[] bytes)
           
 void write(byte[] bytes, int offset, int length)
           
 void write(int b)
           
 
Methods inherited from class java.io.OutputStream
close, flush
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GrowablePipedOutputStream

public GrowablePipedOutputStream()
Create a new GrowablePipedOutputStream.


GrowablePipedOutputStream

public GrowablePipedOutputStream(GrowablePipedInputStream sink)
                          throws java.io.IOException
Create a new GrowablePipedOutputStream.

Parameters:
snk -
Throws:
java.io.IOException
Method Detail

write

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

write

public void write(byte[] bytes)
           throws java.io.IOException
Overrides:
write in class java.io.OutputStream
Throws:
java.io.IOException

write

public void write(byte[] bytes,
                  int offset,
                  int length)
           throws java.io.IOException
Overrides:
write in class java.io.OutputStream
Throws:
java.io.IOException

connect

protected void connect(GrowablePipedInputStream sink)
                throws java.io.IOException
Throws:
java.io.IOException

isConnected

protected boolean isConnected()


Copyright 1998-2005 JBoss Inc . All Rights Reserved.