|
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||
java.lang.Objectjava.io.InputStream
org.exist.validation.internal.BlockingInputStream
public class BlockingInputStream
BlockingOutputStream is a combination of an output stream and
an input stream, connected through a (circular) buffer in memory.
It is intended for coupling producer threads to consumer threads via a
(byte) stream.
When the buffer is full producer threads will be blocked until the buffer
has some free space again. When the buffer is empty the consumer threads will
be blocked until some bytes are available again.
| Constructor Summary | |
|---|---|
BlockingInputStream()
|
|
| Method Summary | |
|---|---|
int |
available()
The number of bytes that can be read (or skipped over) from this input stream without blocking by the next caller of a method for this input stream. |
void |
close()
Equivalent of the close() method of an output stream. |
void |
closeInputStream()
Closes this input stream and releases any system resources associated with the stream. |
void |
flush()
Flushes this output stream and forces any buffered output bytes to be written out. |
int |
free()
The number of bytes that can be written to this output stream without blocking by the next caller of a method for this output stream. |
int |
read()
Reads the next byte of data from the input stream. |
int |
read(byte[] b,
int off,
int len)
Reads up to len bytes of data from the input stream into
an array of bytes. |
void |
write(byte[] b,
int off,
int len)
Writes len bytes from the specified byte array
starting at offset off to this output stream. |
void |
write(int b)
Writes the specified byte to this output stream. |
| Methods inherited from class java.io.InputStream |
|---|
mark, markSupported, read, reset, skip |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public BlockingInputStream()
| 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 thrown.
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 the input stream into
an array of bytes. An attempt is made to read as many as
len bytes, but a smaller number may be read.
The number of bytes actually read is returned as an integer.
This method blocks until input data is available, end of file is detected, or an exception is thrown.
read in class InputStreamb - the buffer into which the data is read.off - the start offset in array b
at which the data is written.len - the maximum number of bytes to read.
-1 if there is no more data because the end of
the stream has been reached.
IOException - if an I/O error occurs.
NullPointerException - if b is null.
public void closeInputStream()
throws IOException
IOException - if an I/O error occurs.public int available()
available in class InputStreamIOException - if an I/O error occurs.
public void write(int b)
throws IOException
write is that one byte is written
to the output stream. The byte to be written is the eight
low-order bits of the argument b. The 24
high-order bits of b are ignored.
b - the byte.
IOException - if an I/O error occurs. In particular,
an IOException may be thrown if the
output stream has been closed.
public void write(byte[] b,
int off,
int len)
throws IOException
len bytes from the specified byte array
starting at offset off to this output stream.
The general contract for write(b, off, len) is that
some of the bytes in the array b are written to the
output stream in order; element b[off] is the first
byte written and b[off+len-1] is the last byte written
by this operation.
b - the data.off - the start offset in the data.len - the number of bytes to write.
IOException - if an I/O error occurs. In particular,
an IOException is thrown if the output
stream is closed.
public void close()
throws IOException
close() method of an output stream.
Renamed to solve the name clash with the close() method
of the input stream also implemented by this class.
Closes this output stream and releases any system resources
associated with this stream. A closed stream cannot perform
output operations and cannot be reopened.
This method blocks its caller until all bytes remaining in the buffer are read from the buffer by the receiving threads or an exception occurs.
close in interface Closeableclose in class InputStreamIOException - if an I/O error occurs.
public void flush()
throws IOException
This methods blocks its caller until all buffered bytes are actually read by the consuming threads.
IOException - if an I/O error occurs.public int free()
IOException - if an I/O error occurs.
|
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||