com.ados.hestia.utils.io
Class JoinInputStream

java.lang.Object
  extended by java.io.InputStream
      extended by com.ados.hestia.utils.io.JoinInputStream
All Implemented Interfaces:
Closeable

public class JoinInputStream
extends InputStream

Stream, wich combines many other input sources.
This takes array of other streams and virtually
creates single stream which transitively reads
data from initial array of streams.

Version:
$Revision: 1312 $ $Date: 2005-11-09 07:34:17 +0900 $

Field Summary
protected  byte[] m_buffer
           
protected  int m_currentStream
           
protected  int m_filllen
           
protected  ArrayList<InputStream> m_list
           
protected  int m_readpos
           
 
Constructor Summary
JoinInputStream(InputStream[] streams)
          Construct.
 
Method Summary
 int available()
          
protected  int availableInternal()
          Returns number of bytes available at internal buffer.
 void close()
          
protected  void fill()
          Fill Internal buffer from streams.
 int read()
          
 
Methods inherited from class java.io.InputStream
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_list

protected ArrayList<InputStream> m_list

m_buffer

protected byte[] m_buffer

m_readpos

protected int m_readpos

m_filllen

protected int m_filllen

m_currentStream

protected int m_currentStream
Constructor Detail

JoinInputStream

public JoinInputStream(InputStream[] streams)
                throws IOException
Construct.

Parameters:
streams - array of underlayed streams to compose virtual stream.
Throws:
IOException - if no one underlayed stream is present.
Method Detail

read

public int read()
         throws IOException

Specified by:
read in class InputStream
Throws:
IOException

close

public void close()
           throws IOException

Specified by:
close in interface Closeable
Overrides:
close in class InputStream
Throws:
IOException

available

public int available()
              throws IOException

Overrides:
available in class InputStream
Throws:
IOException

availableInternal

protected int availableInternal()
Returns number of bytes available at internal buffer.

Returns:
number of bytes available at internal buffer.

fill

protected void fill()
             throws IOException
Fill Internal buffer from streams.

Throws:
IOException - if one of stream cannot be read.


Copyright © 2005-2006 ADOS Co.,Ltd.. All Rights Reserved.