FileDocCategorySizeDatePackage
DemuxInputStream.javaAPI DocAndroid 1.5 API2669Wed May 06 22:42:46 BST 2009org.apache.commons.io.input

DemuxInputStream

public class DemuxInputStream extends InputStream
Data written to this stream is forwarded to a stream that has been associated with this thread.
author
Peter Donald
version
$Revision: 437567 $ $Date: 2006-08-28 07:39:07 +0100 (Mon, 28 Aug 2006) $

Fields Summary
private InheritableThreadLocal
m_streams
Constructors Summary
Methods Summary
public java.io.InputStreambindStream(java.io.InputStream input)
Bind the specified stream to the current thread.

param
input the stream to bind
return
the InputStream that was previously active


                              
         
    
        InputStream oldValue = getStream();
        m_streams.set( input );
        return oldValue;
    
public voidclose()
Closes stream associated with current thread.

throws
IOException if an error occurs

        InputStream input = getStream();
        if( null != input )
        {
            input.close();
        }
    
private java.io.InputStreamgetStream()
Utility method to retrieve stream bound to current thread (if any).

return
the input stream

        return (InputStream)m_streams.get();
    
public intread()
Read byte from stream associated with current thread.

return
the byte read from stream
throws
IOException if an error occurs

        InputStream input = getStream();
        if( null != input )
        {
            return input.read();
        }
        else
        {
            return -1;
        }