class Channel.Output
extends java.lang.Object
stream
and buffer
is set, or the sink
is set, but those
are mutually exclusive. The former is used when we are buffering data and let the application
read it via InputStream
, and the latter is used when we are passing through the data
to another OutputStream
.
The synchronization is done by Channel
Modifier and Type | Field and Description |
---|---|
(package private) FifoBuffer |
buffer |
(package private) java.io.OutputStream |
sink |
(package private) ChannelInputStream |
stream |
Constructor and Description |
---|
Output() |
Modifier and Type | Method and Description |
---|---|
int |
available()
See
InputStream.available() |
void |
eof()
Called when there will be no more data arriving to this output any more.
|
void |
pipeTo(java.io.OutputStream os)
Instead of spooling data, let our I/O thread write to the given
OutputStream . |
int |
read(byte[] buf,
int start,
int len)
Read from the buffer.
|
int |
readable()
How many bytes can be read from the buffer?
|
void |
write(byte[] buf,
int start,
int len) |
ChannelInputStream stream
FifoBuffer buffer
java.io.OutputStream sink
public void write(byte[] buf, int start, int len) throws java.io.IOException
java.io.IOException
public int readable()
public int available()
InputStream.available()
public int read(byte[] buf, int start, int len) throws java.lang.InterruptedException
java.lang.InterruptedException
public void eof()
public void pipeTo(java.io.OutputStream os) throws java.io.IOException
OutputStream
.java.io.IOException