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[]
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 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 int
available()
void
close()
void
eof()
Signal end of writing to the sinklong
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)
-
-
-
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
ChannelPipedOutputStream
is already closed and so we will not receive additional data. This is different from theisOpen()
, which indicates that the reader of thisInputStream
will 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:
isOpen
in interfacejava.nio.channels.Channel
-
setTimeout
public void setTimeout(long timeout)
-
getTimeout
public long getTimeout()
-
available
public int available() throws java.io.IOException
- Overrides:
available
in classjava.io.InputStream
- Throws:
java.io.IOException
-
read
public int read() throws java.io.IOException
- Specified by:
read
in classjava.io.InputStream
- Throws:
java.io.IOException
-
read
public int read(byte[] b, int off, int len) throws java.io.IOException
- Overrides:
read
in classjava.io.InputStream
- Throws:
java.io.IOException
-
eof
public void eof()
Description copied from interface:ChannelPipedSink
Signal end of writing to the sink- Specified by:
eof
in interfaceChannelPipedSink
-
close
public void close() throws java.io.IOException
- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfacejava.nio.channels.Channel
- Specified by:
close
in interfacejava.io.Closeable
- Overrides:
close
in classjava.io.InputStream
- Throws:
java.io.IOException
-
receive
public void receive(byte[] bytes, int off, int len) throws java.io.IOException
- Specified by:
receive
in 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
-
-