Package org.apache.sshd.common.channel
Class ChannelOutputStream
- java.lang.Object
-
- java.io.OutputStream
-
- org.apache.sshd.common.channel.ChannelOutputStream
-
- All Implemented Interfaces:
java.io.Closeable,java.io.Flushable,java.lang.AutoCloseable,java.nio.channels.Channel,ChannelHolder
public class ChannelOutputStream extends java.io.OutputStream implements java.nio.channels.Channel, ChannelHolder
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static classChannelOutputStream.OpenStateprotected static classChannelOutputStream.WriteState
-
Field Summary
Fields Modifier and Type Field Description private Bufferbufferprivate intbufferLengthprivate java.lang.ObjectbufferLockprivate AbstractChannelchannelInstanceprivate bytecmdprivate booleaneofOnCloseprivate booleanisFlushingprivate intlastSizeprotected org.slf4j.Loggerlogprivate java.time.DurationmaxWaitTimeoutprivate java.util.concurrent.atomic.AtomicBooleannoDelayprotected java.util.concurrent.atomic.AtomicReference<ChannelOutputStream.OpenState>openStateprivate ChannelStreamWriterpacketWriterprivate RemoteWindowremoteWindow
-
Constructor Summary
Constructors Constructor Description ChannelOutputStream(AbstractChannel channel, RemoteWindow remoteWindow, long maxWaitTimeout, org.slf4j.Logger log, byte cmd, boolean eofOnClose)ChannelOutputStream(AbstractChannel channel, RemoteWindow remoteWindow, java.time.Duration maxWaitTimeout, org.slf4j.Logger log, byte cmd, boolean eofOnClose)ChannelOutputStream(AbstractChannel channel, RemoteWindow remoteWindow, org.slf4j.Logger log, byte cmd, boolean eofOnClose)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()voidflush()AbstractChannelgetChannel()bytegetCommandType()booleanisEofOnClose()booleanisNoDelay()booleanisOpen()protected BuffernewBuffer(int size)voidsetNoDelay(boolean noDelay)java.lang.StringtoString()voidwrite(byte[] buf, int s, int l)voidwrite(int w)
-
-
-
Field Detail
-
openState
protected final java.util.concurrent.atomic.AtomicReference<ChannelOutputStream.OpenState> openState
-
log
protected final org.slf4j.Logger log
-
channelInstance
private final AbstractChannel channelInstance
-
packetWriter
private final ChannelStreamWriter packetWriter
-
remoteWindow
private final RemoteWindow remoteWindow
-
maxWaitTimeout
private final java.time.Duration maxWaitTimeout
-
cmd
private final byte cmd
-
eofOnClose
private final boolean eofOnClose
-
noDelay
private final java.util.concurrent.atomic.AtomicBoolean noDelay
-
bufferLock
private final java.lang.Object bufferLock
-
buffer
private Buffer buffer
-
bufferLength
private int bufferLength
-
lastSize
private int lastSize
-
isFlushing
private boolean isFlushing
-
-
Constructor Detail
-
ChannelOutputStream
public ChannelOutputStream(AbstractChannel channel, RemoteWindow remoteWindow, org.slf4j.Logger log, byte cmd, boolean eofOnClose)
-
ChannelOutputStream
public ChannelOutputStream(AbstractChannel channel, RemoteWindow remoteWindow, long maxWaitTimeout, org.slf4j.Logger log, byte cmd, boolean eofOnClose)
-
ChannelOutputStream
public ChannelOutputStream(AbstractChannel channel, RemoteWindow remoteWindow, java.time.Duration maxWaitTimeout, org.slf4j.Logger log, byte cmd, boolean eofOnClose)
-
-
Method Detail
-
getChannel
public AbstractChannel getChannel()
- Specified by:
getChannelin interfaceChannelHolder- Returns:
- The associated
Channelinstance
-
getCommandType
public byte getCommandType()
- Returns:
- Either
SSH_MSG_CHANNEL_DATAorSSH_MSG_CHANNEL_EXTENDED_DATAindicating the output stream type
-
isEofOnClose
public boolean isEofOnClose()
-
isNoDelay
public boolean isNoDelay()
-
setNoDelay
public void setNoDelay(boolean noDelay)
-
isOpen
public boolean isOpen()
- Specified by:
isOpenin interfacejava.nio.channels.Channel
-
write
public void write(int w) throws java.io.IOException- Specified by:
writein classjava.io.OutputStream- Throws:
java.io.IOException
-
write
public void write(byte[] buf, int s, int l) throws java.io.IOException- Overrides:
writein classjava.io.OutputStream- Throws:
java.io.IOException
-
flush
public void flush() throws java.io.IOException- Specified by:
flushin interfacejava.io.Flushable- Overrides:
flushin classjava.io.OutputStream- Throws:
java.io.IOException
-
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.OutputStream- Throws:
java.io.IOException
-
newBuffer
protected Buffer newBuffer(int size)
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-