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

java.lang.Object
  extended by java.io.InputStream
      extended by org.jboss.remoting.transport.multiplex.utility.GrowablePipedInputStream
All Implemented Interfaces:
java.io.Closeable
Direct Known Subclasses:
MultiplexingInputStream

public class GrowablePipedInputStream
extends java.io.InputStream

GrowablePipedInputStream is the parent of the MultiplexingInputStream returned by VirtualSocket.getInputStream(). GrowablePipedInputStream and GrowablePipedOutputStream work together like java.io.PipedInputStream and java.io.PipedOutputStream, 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.InputStream javadoc.

Version:
$Revision: 1248 $

Copyright (c) 2005

Author:
Ron Sigal

Field Summary
protected static org.jboss.logging.Logger log
           
 
Constructor Summary
GrowablePipedInputStream()
          Create a new GrowablePipedInputStream.
GrowablePipedInputStream(GrowablePipedOutputStream source)
          Create a new GrowablePipedInputStream.
GrowablePipedInputStream(GrowablePipedOutputStream source, VirtualSelector virtualSelector)
          Create a new GrowablePipedInputStream.
GrowablePipedInputStream(VirtualSelector virtualSelector)
          Create a new GrowablePipedInputStream.
 
Method Summary
 int available()
           
 void close()
           
protected  void connect(GrowablePipedOutputStream source)
           
 int getTimeout()
           
protected  boolean isConnected()
           
 int read()
           
 int read(byte[] bytes)
           
 int read(byte[] bytes, int offset, int length)
           
protected  void receive(byte[] bytes)
           
protected  void receive(byte[] bytes, int offset, int length)
           
protected  void receive(int i)
           
 void register(VirtualSelector virtualSelector, java.lang.Object attachment)
           
 void setTimeout(int timeout)
           
 
Methods inherited from class java.io.InputStream
mark, markSupported, reset, skip
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

protected static final org.jboss.logging.Logger log
Constructor Detail

GrowablePipedInputStream

public GrowablePipedInputStream()
Create a new GrowablePipedInputStream.


GrowablePipedInputStream

public GrowablePipedInputStream(VirtualSelector virtualSelector)
Create a new GrowablePipedInputStream.

Parameters:
virtualSelector -

GrowablePipedInputStream

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

Parameters:
src -
Throws:
java.io.IOException

GrowablePipedInputStream

public GrowablePipedInputStream(GrowablePipedOutputStream source,
                                VirtualSelector virtualSelector)
                         throws java.io.IOException
Create a new GrowablePipedInputStream.

Parameters:
virtualSelector -
src -
Throws:
java.io.IOException
Method Detail

available

public int available()
Overrides:
available in class java.io.InputStream

close

public void close()
           throws java.io.IOException
Specified by:
close in interface java.io.Closeable
Overrides:
close in class java.io.InputStream
Throws:
java.io.IOException

getTimeout

public int getTimeout()

read

public int read()
         throws java.io.IOException
Specified by:
read in class java.io.InputStream
Throws:
java.io.IOException

read

public int read(byte[] bytes)
         throws java.io.IOException
Overrides:
read in class java.io.InputStream
Throws:
java.io.IOException

read

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

register

public void register(VirtualSelector virtualSelector,
                     java.lang.Object attachment)

setTimeout

public void setTimeout(int timeout)

connect

protected void connect(GrowablePipedOutputStream source)
                throws java.io.IOException
Throws:
java.io.IOException

isConnected

protected boolean isConnected()

receive

protected void receive(int i)
                throws java.io.IOException
Throws:
java.io.IOException

receive

protected void receive(byte[] bytes)
                throws java.io.IOException
Throws:
java.io.IOException

receive

protected void receive(byte[] bytes,
                       int offset,
                       int length)
                throws java.io.IOException
Throws:
java.io.IOException


Copyright © 1998-2005 JBoss Inc . All Rights Reserved.