Package org.apache.sshd.common.channel
Class ChannelPipedInputStream
- java.lang.Object
-
- java.io.InputStream
-
- org.apache.sshd.common.channel.ChannelPipedInputStream
-
- All Implemented Interfaces:
java.io.Closeable,java.lang.AutoCloseable,java.nio.channels.Channel,ChannelPipedSink
public class ChannelPipedInputStream extends java.io.InputStream implements ChannelPipedSink
TODO Add javadoc
-
-
Field Summary
Fields Modifier and Type Field Description private byte[]bprivate Bufferbufferprivate java.util.concurrent.locks.ConditiondataAvailableprivate java.util.concurrent.atomic.AtomicBooleaneofSentprivate WindowlocalWindowprivate java.util.concurrent.locks.Locklockprivate java.util.concurrent.atomic.AtomicBooleanopenprivate longtimeoutprivate java.util.concurrent.atomic.AtomicBooleanwriterClosedChannelPipedOutputStreamis already closed and so we will not receive additional data.
-
Constructor Summary
Constructors Constructor Description ChannelPipedInputStream(Window localWindow, long windowTimeout)ChannelPipedInputStream(Window localWindow, java.time.Duration windowTimeout)ChannelPipedInputStream(PropertyResolver resolver, Window localWindow)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intavailable()voidclose()voideof()Signal end of writing to the sinklonggetTimeout()booleanisOpen()intread()intread(byte[] b, int off, int len)voidreceive(byte[] bytes, int off, int len)voidsetTimeout(long timeout)
-
-
-
Field Detail
-
localWindow
private final Window localWindow
-
buffer
private final Buffer buffer
-
b
private final byte[] b
-
open
private final java.util.concurrent.atomic.AtomicBoolean open
-
eofSent
private final java.util.concurrent.atomic.AtomicBoolean eofSent
-
lock
private final java.util.concurrent.locks.Lock lock
-
dataAvailable
private final java.util.concurrent.locks.Condition dataAvailable
-
writerClosed
private final java.util.concurrent.atomic.AtomicBoolean writerClosed
ChannelPipedOutputStreamis already closed and so we will not receive additional data. This is different from theisOpen(), which indicates that the reader of thisInputStreamwill not be reading data any more.
-
timeout
private long timeout
-
-
Constructor Detail
-
ChannelPipedInputStream
public ChannelPipedInputStream(PropertyResolver resolver, Window localWindow)
-
ChannelPipedInputStream
public ChannelPipedInputStream(Window localWindow, java.time.Duration windowTimeout)
-
ChannelPipedInputStream
public ChannelPipedInputStream(Window localWindow, long windowTimeout)
-
-
Method Detail
-
isOpen
public boolean isOpen()
- Specified by:
isOpenin interfacejava.nio.channels.Channel
-
setTimeout
public void setTimeout(long timeout)
-
getTimeout
public long getTimeout()
-
available
public int available() throws java.io.IOException- Overrides:
availablein classjava.io.InputStream- Throws:
java.io.IOException
-
read
public int read() throws java.io.IOException- Specified by:
readin classjava.io.InputStream- Throws:
java.io.IOException
-
read
public int read(byte[] b, int off, int len) throws java.io.IOException- Overrides:
readin classjava.io.InputStream- Throws:
java.io.IOException
-
eof
public void eof()
Description copied from interface:ChannelPipedSinkSignal end of writing to the sink- Specified by:
eofin interfaceChannelPipedSink
-
close
public void close() throws java.io.IOException- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.nio.channels.Channel- Specified by:
closein interfacejava.io.Closeable- Overrides:
closein classjava.io.InputStream- Throws:
java.io.IOException
-
receive
public void receive(byte[] bytes, int off, int len) throws java.io.IOException- Specified by:
receivein interfaceChannelPipedSink- Parameters:
bytes- Bytes to be sent to the sinkoff- Offset in bufferlen- Number of bytes- Throws:
java.io.IOException- If failed to send the data
-
-