Class DefaultChannelStreamWriter

java.lang.Object
org.apache.sshd.common.channel.throttle.DefaultChannelStreamWriter
All Implemented Interfaces:
Closeable, AutoCloseable, Channel, ChannelStreamWriter

public class DefaultChannelStreamWriter extends Object implements ChannelStreamWriter
A ChannelStreamWriter that simply calls the Channel.writePacket(Buffer) method.
Author:
Apache MINA SSHD Project
  • Field Details

    • channel

      protected final Channel channel
    • closed

      protected volatile boolean closed
  • Constructor Details

    • DefaultChannelStreamWriter

      public DefaultChannelStreamWriter(Channel channel)
  • Method Details

    • writeData

      public IoWriteFuture writeData(Buffer buffer) throws IOException
      Description copied from interface: ChannelStreamWriter
      Encode and send the given data packet buffer. Note: the buffer has to have 5 bytes free at the beginning to allow the encoding to take place. Also, the write position of the buffer has to be set to the position of the last byte to write.
      Specified by:
      writeData in interface ChannelStreamWriter
      Parameters:
      buffer - the buffer to encode and send. NOTE: the buffer must not be touched until the returned write future is completed.
      Returns:
      An IoWriteFuture that can be used to check when the packet has actually been sent
      Throws:
      IOException - if an error occurred when encoding or sending the packet
    • isOpen

      public boolean isOpen()
      Specified by:
      isOpen in interface Channel
    • close

      public void close() throws IOException
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Channel
      Specified by:
      close in interface Closeable
      Throws:
      IOException