org.apache.commons.io.input
Class DemuxInputStream

java.lang.Object
  extended byjava.io.InputStream
      extended byorg.apache.commons.io.input.DemuxInputStream

public class DemuxInputStream
extends java.io.InputStream

Data written to this stream is forwarded to a stream that has been associated with this thread.

Version:
$Revision: 1.4 $ $Date: 2003/12/30 06:55:59 $
Author:
Peter Donald

Field Summary
private  java.lang.InheritableThreadLocal m_streams
           
 
Fields inherited from class java.io.InputStream
 
Constructor Summary
DemuxInputStream()
           
 
Method Summary
 java.io.InputStream bindStream(java.io.InputStream input)
          Bind the specified stream to the current thread.
 void close()
          Closes stream associated with current thread.
private  java.io.InputStream getStream()
          Utility method to retrieve stream bound to current thread (if any).
 int read()
          Read byte from stream associated with current thread.
 
Methods inherited from class java.io.InputStream
available, mark, markSupported, read, read, reset, skip
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_streams

private java.lang.InheritableThreadLocal m_streams
Constructor Detail

DemuxInputStream

public DemuxInputStream()
Method Detail

bindStream

public java.io.InputStream bindStream(java.io.InputStream input)
Bind the specified stream to the current thread.

Parameters:
input - the stream to bind
Returns:
the InputStream that was previously active

close

public void close()
           throws java.io.IOException
Closes stream associated with current thread.

Throws:
java.io.IOException - if an error occurs

read

public int read()
         throws java.io.IOException
Read byte from stream associated with current thread.

Returns:
the byte read from stream
Throws:
java.io.IOException - if an error occurs

getStream

private java.io.InputStream getStream()
Utility method to retrieve stream bound to current thread (if any).