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
-
-
Field Summary
Fields Modifier and Type Field Description private byte[]
b
private Buffer
buffer
private int
bufferLength
private AbstractChannel
channelInstance
private java.util.concurrent.atomic.AtomicBoolean
closedState
private byte
cmd
private boolean
eofOnClose
private int
lastSize
protected org.slf4j.Logger
log
private java.time.Duration
maxWaitTimeout
private boolean
noDelay
private ChannelStreamWriter
packetWriter
private Window
remoteWindow
-
Constructor Summary
Constructors Constructor Description ChannelOutputStream(AbstractChannel channel, Window remoteWindow, long maxWaitTimeout, org.slf4j.Logger log, byte cmd, boolean eofOnClose)
ChannelOutputStream(AbstractChannel channel, Window remoteWindow, java.time.Duration maxWaitTimeout, org.slf4j.Logger log, byte cmd, boolean eofOnClose)
ChannelOutputStream(AbstractChannel channel, Window remoteWindow, org.slf4j.Logger log, byte cmd, boolean eofOnClose)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
void
flush()
AbstractChannel
getChannel()
byte
getCommandType()
boolean
isEofOnClose()
boolean
isNoDelay()
boolean
isOpen()
protected void
newBuffer(int size)
void
setNoDelay(boolean noDelay)
java.lang.String
toString()
void
write(byte[] buf, int s, int l)
void
write(int w)
-
-
-
Field Detail
-
log
protected final org.slf4j.Logger log
-
channelInstance
private final AbstractChannel channelInstance
-
packetWriter
private final ChannelStreamWriter packetWriter
-
remoteWindow
private final Window remoteWindow
-
maxWaitTimeout
private final java.time.Duration maxWaitTimeout
-
cmd
private final byte cmd
-
eofOnClose
private final boolean eofOnClose
-
b
private final byte[] b
-
closedState
private final java.util.concurrent.atomic.AtomicBoolean closedState
-
buffer
private Buffer buffer
-
bufferLength
private int bufferLength
-
lastSize
private int lastSize
-
noDelay
private boolean noDelay
-
-
Constructor Detail
-
ChannelOutputStream
public ChannelOutputStream(AbstractChannel channel, Window remoteWindow, org.slf4j.Logger log, byte cmd, boolean eofOnClose)
-
ChannelOutputStream
public ChannelOutputStream(AbstractChannel channel, Window remoteWindow, long maxWaitTimeout, org.slf4j.Logger log, byte cmd, boolean eofOnClose)
-
ChannelOutputStream
public ChannelOutputStream(AbstractChannel channel, Window remoteWindow, java.time.Duration maxWaitTimeout, org.slf4j.Logger log, byte cmd, boolean eofOnClose)
-
-
Method Detail
-
getChannel
public AbstractChannel getChannel()
- Specified by:
getChannel
in interfaceChannelHolder
- Returns:
- The associated
Channel
instance
-
getCommandType
public byte getCommandType()
- Returns:
- Either
SSH_MSG_CHANNEL_DATA
orSSH_MSG_CHANNEL_EXTENDED_DATA
indicating the output stream type
-
isEofOnClose
public boolean isEofOnClose()
-
isNoDelay
public boolean isNoDelay()
-
setNoDelay
public void setNoDelay(boolean noDelay)
-
isOpen
public boolean isOpen()
- Specified by:
isOpen
in interfacejava.nio.channels.Channel
-
write
public void write(int w) throws java.io.IOException
- Specified by:
write
in classjava.io.OutputStream
- Throws:
java.io.IOException
-
write
public void write(byte[] buf, int s, int l) throws java.io.IOException
- Overrides:
write
in classjava.io.OutputStream
- Throws:
java.io.IOException
-
flush
public void flush() throws java.io.IOException
- Specified by:
flush
in interfacejava.io.Flushable
- Overrides:
flush
in classjava.io.OutputStream
- Throws:
java.io.IOException
-
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.OutputStream
- Throws:
java.io.IOException
-
newBuffer
protected void newBuffer(int size)
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-