public class ChannelPipedInputStream extends java.io.InputStream implements ChannelPipedSink
| Modifier and Type | Field and Description |
|---|---|
private byte[] |
b |
private Buffer |
buffer |
private java.util.concurrent.locks.Condition |
dataAvailable |
private java.util.concurrent.atomic.AtomicBoolean |
eofSent |
private Window |
localWindow |
private java.util.concurrent.locks.Lock |
lock |
private java.util.concurrent.atomic.AtomicBoolean |
open |
private long |
timeout |
private java.util.concurrent.atomic.AtomicBoolean |
writerClosed
ChannelPipedOutputStream is already closed and so we will not receive additional data. |
| Constructor and Description |
|---|
ChannelPipedInputStream(PropertyResolver resolver,
Window localWindow) |
ChannelPipedInputStream(Window localWindow,
long windowTimeout) |
| Modifier and Type | Method and Description |
|---|---|
int |
available() |
void |
close() |
void |
eof()
Signal end of writing to the sink
|
long |
getTimeout() |
boolean |
isOpen() |
int |
read() |
int |
read(byte[] b,
int off,
int len) |
void |
receive(byte[] bytes,
int off,
int len) |
void |
setTimeout(long timeout) |
private final Window localWindow
private final Buffer buffer
private final byte[] b
private final java.util.concurrent.atomic.AtomicBoolean open
private final java.util.concurrent.atomic.AtomicBoolean eofSent
private final java.util.concurrent.locks.Lock lock
private final java.util.concurrent.locks.Condition dataAvailable
private final java.util.concurrent.atomic.AtomicBoolean writerClosed
ChannelPipedOutputStream is already closed and so we will not receive additional data. This is different
from the isOpen(), which indicates that the reader of this InputStream will not be reading data
any more.private long timeout
public ChannelPipedInputStream(PropertyResolver resolver, Window localWindow)
public ChannelPipedInputStream(Window localWindow, long windowTimeout)
public boolean isOpen()
isOpen in interface java.nio.channels.Channelpublic void setTimeout(long timeout)
public long getTimeout()
public int available()
throws java.io.IOException
available in class java.io.InputStreamjava.io.IOExceptionpublic int read()
throws java.io.IOException
read in class java.io.InputStreamjava.io.IOExceptionpublic int read(byte[] b,
int off,
int len)
throws java.io.IOException
read in class java.io.InputStreamjava.io.IOExceptionpublic void eof()
ChannelPipedSinkeof in interface ChannelPipedSinkpublic void close()
throws java.io.IOException
close in interface java.io.Closeableclose in interface java.lang.AutoCloseableclose in interface java.nio.channels.Channelclose in class java.io.InputStreamjava.io.IOExceptionpublic void receive(byte[] bytes,
int off,
int len)
throws java.io.IOException
receive in interface ChannelPipedSinkbytes - Bytes to be sent to the sinkoff - Offset in bufferlen - Number of bytesjava.io.IOException - If failed to send the data