Top Inners Fields Constructors Methods
org.apache.sshd.common.channel

public Class ChannelOutputStream

extends OutputStream
implements Channel, ChannelHolder
Class Inheritance
All Implemented Interfaces
org.apache.sshd.common.channel.ChannelHolder, java.nio.channels.Channel, java.io.Closeable, java.lang.AutoCloseable
Imports
java.io.IOException, .InterruptedIOException, .OutputStream, .StreamCorruptedException, java.time.Duration, java.util.Objects, java.util.concurrent.TimeUnit, java.util.concurrent.atomic.AtomicBoolean, .AtomicReference, org.apache.sshd.common.SshConstants, .SshException, org.apache.sshd.common.channel.exception.SshChannelClosedException, org.apache.sshd.common.channel.throttle.ChannelStreamWriter, org.apache.sshd.common.session.Session, org.apache.sshd.common.util.GenericUtils, .ValidateUtils, org.apache.sshd.common.util.buffer.Buffer, org.apache.sshd.common.util.logging.LoggingUtils, org.apache.sshd.core.CoreModuleProperties, org.slf4j.Logger

Author
Apache MINA SSHD Project

Nested and Inner Type Summary

Modifier and TypeClass and Description
protected static enum
protected static enum

Field Summary

Modifier and TypeField and Description
private Buffer
private int
private final Object
private final AbstractChannel
private final byte
private final boolean
private boolean
private int
protected final Logger
private final Duration
private final AtomicBoolean
protected final AtomicReference<ChannelOutputStream.OpenState>
private final ChannelStreamWriter
private final RemoteWindow

Constructor Summary

AccessConstructor and Description
public
ChannelOutputStream(AbstractChannel channel, RemoteWindow remoteWindow, Logger log, byte cmd, boolean eofOnClose)

public
ChannelOutputStream(AbstractChannel channel, RemoteWindow remoteWindow, long maxWaitTimeout, Logger log, byte cmd, boolean eofOnClose)

public
ChannelOutputStream(AbstractChannel channel, RemoteWindow remoteWindow, Duration maxWaitTimeout, Logger log, byte cmd, boolean eofOnClose)

Method Summary

Modifier and TypeMethod and Description
public void
public void
flush()

Overrides java.io.OutputStream.flush.

Implements java.io.Flushable.flush.

Flushes this output stream and forces any buffered output bytes to be written out.

public AbstractChannel
public byte

Returns:

Either SSH_MSG_CHANNEL_DATA or SSH_MSG_CHANNEL_EXTENDED_DATA indicating the output stream type
getCommandType
()

public boolean
public boolean
public boolean
isOpen()

Implements java.nio.channels.Channel.isOpen.

Tells whether or not this channel is open.

protected Buffer
newBuffer(int size)

public void
setNoDelay(boolean noDelay)

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

public void
write(int
the byte.
w
)

Implements abstract java.io.OutputStream.write.

Writes the specified byte to this output stream.

public synchronized void
write(byte[]
the data.
buf
,
int
the start offset in the data.
s
,
int
the number of bytes to write.
l
)

Overrides java.io.OutputStream.write.

Writes len bytes from the specified byte array starting at offset off to this output stream.

Inherited from java.io.OutputStream:
nullOutputStreamwrite

Field Detail

bufferback to summary
private Buffer buffer
bufferLengthback to summary
private int bufferLength
bufferLockback to summary
private final Object bufferLock
channelInstanceback to summary
private final AbstractChannel channelInstance
cmdback to summary
private final byte cmd
eofOnCloseback to summary
private final boolean eofOnClose
isFlushingback to summary
private boolean isFlushing
lastSizeback to summary
private int lastSize
logback to summary
protected final Logger log
maxWaitTimeoutback to summary
private final Duration maxWaitTimeout
noDelayback to summary
private final AtomicBoolean noDelay
openStateback to summary
protected final AtomicReference<ChannelOutputStream.OpenState> openState
packetWriterback to summary
private final ChannelStreamWriter packetWriter
remoteWindowback to summary
private final RemoteWindow remoteWindow

Constructor Detail

ChannelOutputStreamback to summary
public ChannelOutputStream(AbstractChannel channel, RemoteWindow remoteWindow, Logger log, byte cmd, boolean eofOnClose)
ChannelOutputStreamback to summary
public ChannelOutputStream(AbstractChannel channel, RemoteWindow remoteWindow, long maxWaitTimeout, Logger log, byte cmd, boolean eofOnClose)
ChannelOutputStreamback to summary
public ChannelOutputStream(AbstractChannel channel, RemoteWindow remoteWindow, Duration maxWaitTimeout, Logger log, byte cmd, boolean eofOnClose)

Method Detail

closeback to summary
public void close() throws IOException

Overrides java.io.OutputStream.close.

Implements java.nio.channels.Channel.close, java.io.Closeable.close.

Doc from java.nio.channels.Channel.close.

Closes this channel.

After a channel is closed, any further attempt to invoke I/O operations upon it will cause a ClosedChannelException to be thrown.

If this channel is already closed then invoking this method has no effect.

This method may be invoked at any time. If some other thread has already invoked it, however, then another invocation will block until the first invocation is complete, after which it will return without effect.

Annotations
@Override
Exceptions
IOException:
If an I/O error occurs
flushback to summary
public void flush() throws IOException

Overrides java.io.OutputStream.flush.

Implements java.io.Flushable.flush.

Doc from java.io.OutputStream.flush.

Flushes this output stream and forces any buffered output bytes to be written out. The general contract of flush is that calling it is an indication that, if any bytes previously written have been buffered by the implementation of the output stream, such bytes should immediately be written to their intended destination.

If the intended destination of this stream is an abstraction provided by the underlying operating system, for example a file, then flushing the stream guarantees only that bytes previously written to the stream are passed to the operating system for writing; it does not guarantee that they are actually written to a physical device such as a disk drive.

Annotations
@Override
Exceptions
IOException:
if an I/O error occurs.
getChannelback to summary
public AbstractChannel getChannel()

Implements org.apache.sshd.common.channel.ChannelHolder.getChannel.

Returns:AbstractChannel

Doc from org.apache.sshd.common.channel.ChannelHolder.getChannel.

The associated Channel instance

Annotations
@Override
getCommandTypeback to summary
public byte getCommandType()
Returns:byte

Either SSH_MSG_CHANNEL_DATA or SSH_MSG_CHANNEL_EXTENDED_DATA indicating the output stream type

isEofOnCloseback to summary
public boolean isEofOnClose()
isNoDelayback to summary
public boolean isNoDelay()
isOpenback to summary
public boolean isOpen()

Implements java.nio.channels.Channel.isOpen.

Doc from java.nio.channels.Channel.isOpen.

Tells whether or not this channel is open.

Returns:boolean

true if, and only if, this channel is open

Annotations
@Override
newBufferback to summary
protected Buffer newBuffer(int size)
setNoDelayback to summary
public void setNoDelay(boolean noDelay)
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Returns:String

a string representation of the object

Annotations
@Override
writeback to summary
public void write(int w) throws IOException

Implements abstract java.io.OutputStream.write.

Doc from java.io.OutputStream.write.

Writes the specified byte to this output stream. The general contract for write is that one byte is written to the output stream. The byte to be written is the eight low-order bits of the argument b. The 24 high-order bits of b are ignored.

Parameters
w:int

the byte.

Annotations
@Override
Exceptions
IOException:
if an I/O error occurs. In particular, an IOException may be thrown if the output stream has been closed.
writeback to summary
public synchronized void write(byte[] buf, int s, int l) throws IOException

Overrides java.io.OutputStream.write.

Doc from java.io.OutputStream.write.

Writes len bytes from the specified byte array starting at offset off to this output stream. The general contract for write(b, off, len) is that some of the bytes in the array b are written to the output stream in order; element b[off] is the first byte written and b[off+len-1] is the last byte written by this operation.

If b is null, a NullPointerException is thrown.

If off is negative, or len is negative, or off+len is greater than the length of the array b, then an IndexOutOfBoundsException is thrown.

Parameters
buf:byte[]

the data.

s:int

the start offset in the data.

l:int

the number of bytes to write.

Annotations
@Override
Exceptions
IOException:
if an I/O error occurs. In particular, an IOException is thrown if the output stream is closed.
org.apache.sshd.common.channel back to summary

protected final Enum ChannelOutputStream.OpenState

extends Enum<ChannelOutputStream.OpenState>
Class Inheritance

Field Summary

Modifier and TypeField and Description
public static final ChannelOutputStream.OpenState
public static final ChannelOutputStream.OpenState
public static final ChannelOutputStream.OpenState

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static ChannelOutputStream.OpenState
public static ChannelOutputStream.OpenState[]
Inherited from java.lang.Enum:
clonecompareTodescribeConstableequalsfinalizegetDeclaringClasshashCodenameordinaltoStringvalueOf

Field Detail

CLOSEDback to summary
public static final ChannelOutputStream.OpenState CLOSED
CLOSINGback to summary
public static final ChannelOutputStream.OpenState CLOSING
OPENback to summary
public static final ChannelOutputStream.OpenState OPEN

Constructor Detail

OpenStateback to summary
private OpenState()

Method Detail

valueOfback to summary
public static ChannelOutputStream.OpenState valueOf(String name)
valuesback to summary
public static ChannelOutputStream.OpenState[] values()
org.apache.sshd.common.channel back to summary

protected final Enum ChannelOutputStream.WriteState

extends Enum<ChannelOutputStream.WriteState>
Class Inheritance

Field Summary

Modifier and TypeField and Description
public static final ChannelOutputStream.WriteState
public static final ChannelOutputStream.WriteState
public static final ChannelOutputStream.WriteState

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static ChannelOutputStream.WriteState
public static ChannelOutputStream.WriteState[]
Inherited from java.lang.Enum:
clonecompareTodescribeConstableequalsfinalizegetDeclaringClasshashCodenameordinaltoStringvalueOf

Field Detail

BUFFEREDback to summary
public static final ChannelOutputStream.WriteState BUFFERED
NEED_FLUSHback to summary
public static final ChannelOutputStream.WriteState NEED_FLUSH
NEED_SPACEback to summary
public static final ChannelOutputStream.WriteState NEED_SPACE

Constructor Detail

WriteStateback to summary
private WriteState()

Method Detail

valueOfback to summary
public static ChannelOutputStream.WriteState valueOf(String name)
valuesback to summary
public static ChannelOutputStream.WriteState[] values()