Package org.apache.sshd.common.channel
Class ChannelAsyncInputStream
- java.lang.Object
-
- org.apache.sshd.common.util.logging.AbstractLoggingBean
-
- org.apache.sshd.common.util.closeable.IoBaseCloseable
-
- org.apache.sshd.common.util.closeable.AbstractCloseable
-
- org.apache.sshd.common.channel.ChannelAsyncInputStream
-
- All Implemented Interfaces:
java.io.Closeable
,java.lang.AutoCloseable
,java.nio.channels.Channel
,ChannelHolder
,Closeable
,IoInputStream
public class ChannelAsyncInputStream extends AbstractCloseable implements IoInputStream, ChannelHolder
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ChannelAsyncInputStream.IoReadFutureImpl
-
Nested classes/interfaces inherited from class org.apache.sshd.common.util.closeable.AbstractCloseable
AbstractCloseable.State
-
-
Field Summary
Fields Modifier and Type Field Description private Buffer
buffer
private Channel
channelInstance
private ChannelAsyncInputStream.IoReadFutureImpl
pending
private java.lang.Object
readFutureId
-
Fields inherited from class org.apache.sshd.common.util.closeable.AbstractCloseable
closeFuture, futureLock, state
-
Fields inherited from class org.apache.sshd.common.util.logging.AbstractLoggingBean
log
-
-
Constructor Summary
Constructors Constructor Description ChannelAsyncInputStream(Channel channel)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected CloseFuture
doCloseGracefully()
private void
doRead(boolean resume)
Channel
getChannel()
protected void
preClose()
preClose is guaranteed to be called before doCloseGracefully or doCloseImmediately.IoReadFuture
read(Buffer buf)
NOTE: the buffer must not be touched until the returned read future is completed.java.lang.String
toString()
void
write(Readable src)
-
Methods inherited from class org.apache.sshd.common.util.closeable.AbstractCloseable
addCloseFutureListener, builder, close, doCloseImmediately, getFutureLock, isClosed, isClosing, removeCloseFutureListener
-
Methods inherited from class org.apache.sshd.common.util.logging.AbstractLoggingBean
debug, debug, debug, debug, debug, error, error, error, error, error, getSimplifiedLogger, info, info, warn, warn, warn, warn, warn, warn, warn, warn
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.apache.sshd.common.Closeable
addCloseFutureListener, close, close, isClosed, isClosing, isOpen, removeCloseFutureListener
-
-
-
-
Field Detail
-
channelInstance
private final Channel channelInstance
-
buffer
private final Buffer buffer
-
readFutureId
private final java.lang.Object readFutureId
-
pending
private ChannelAsyncInputStream.IoReadFutureImpl pending
-
-
Constructor Detail
-
ChannelAsyncInputStream
public ChannelAsyncInputStream(Channel channel)
-
-
Method Detail
-
getChannel
public Channel getChannel()
- Specified by:
getChannel
in interfaceChannelHolder
- Returns:
- The associated
Channel
instance
-
write
public void write(Readable src) throws java.io.IOException
- Throws:
java.io.IOException
-
read
public IoReadFuture read(Buffer buf)
Description copied from interface:IoInputStream
NOTE: the buffer must not be touched until the returned read future is completed.- Specified by:
read
in interfaceIoInputStream
- Parameters:
buf
- theBuffer
to use- Returns:
- The
IoReadFuture
for the operation
-
preClose
protected void preClose()
Description copied from class:AbstractCloseable
preClose is guaranteed to be called before doCloseGracefully or doCloseImmediately. When preClose() is called, isClosing() == true- Overrides:
preClose
in classAbstractCloseable
-
doCloseGracefully
protected CloseFuture doCloseGracefully()
- Overrides:
doCloseGracefully
in classAbstractCloseable
-
doRead
private void doRead(boolean resume)
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-