|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.io.InputStream
edu.rice.cs.util.JoinInputStream
public class JoinInputStream
| Field Summary | |
|---|---|
protected int |
currentReader
|
static int |
defaultBufferSize
Default size of read buffer. |
protected int |
nReaders
|
protected int |
openedStreams
|
protected edu.rice.cs.util.ReaderThread[] |
reader
|
| Constructor Summary | |
|---|---|
JoinInputStream(InputStream[] streams,
int bufferSize)
Create stream joining streams specified in the array. |
|
JoinInputStream(InputStream one,
InputStream two)
Create stream joining two specified streams. |
|
JoinInputStream(InputStream one,
InputStream two,
int bufferSize)
Create stream joining two specified streams. |
|
| Method Summary | |
|---|---|
void |
close()
Close all attached input streams and stop their listener threads. |
int |
getStreamIndex()
Get index of thread from which data was retrieved in last read operation. |
int |
read()
Reads the next byte of data from one of input streams. |
int |
read(byte[] b,
int off,
int len)
Reads up to len bytes of data from one of input streams
into an array of bytes. |
| Methods inherited from class java.io.InputStream |
|---|
available, mark, markSupported, read, reset, skip |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static int defaultBufferSize
protected int nReaders
protected edu.rice.cs.util.ReaderThread[] reader
protected int currentReader
protected int openedStreams
| Constructor Detail |
|---|
public JoinInputStream(InputStream[] streams,
int bufferSize)
streams - array with input streams which should be joinedbufferSize - specifies size of read buffer
public JoinInputStream(InputStream one,
InputStream two,
int bufferSize)
one - first input stream to be mergedtwo - second input stream to be mergedbufferSize - specifies size of read buffer
public JoinInputStream(InputStream one,
InputStream two)
one - first input stream to be mergedtwo - second input stream to be merged| Method Detail |
|---|
public int read()
throws IOException
int in the range
0 to 255. If no byte is available
because the end of the stream has been reached, the value
-1 is returned. This method blocks until input data
is available, the end of the stream is detected or an exception
is catched.
read in class InputStream-1 if the end of the
stream is reached.
IOException - if an I/O error occurs.
public int read(byte[] b,
int off,
int len)
throws IOException
len bytes of data from one of input streams
into an array of bytes. This method blocks until some input is
available. If the first argument is null, up to
len bytes are read and discarded.
The read method of InputStream reads a
single byte at a time using the read method of zero arguments to
fill in the array. Subclasses are encouraged to provide a more
efficient implementation of this method.
read in class InputStreamb - the buffer into which the data is read.off - the start offset of the data.len - the maximum number of bytes read.
-1 if there is no more data because the end of
the stream has been reached.
IOException - if an I/O error occurs.
public void close()
throws IOException
close in interface Closeableclose in class InputStreamIOExceptionpublic final int getStreamIndex()
read operation. Indices are started from 0.
read operation.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||