Class DefaultChannelStreamWriter
- java.lang.Object
-
- org.apache.sshd.common.channel.throttle.DefaultChannelStreamWriter
-
- All Implemented Interfaces:
java.io.Closeable,java.lang.AutoCloseable,java.nio.channels.Channel,ChannelStreamWriter
public class DefaultChannelStreamWriter extends java.lang.Object implements ChannelStreamWriter
A ChannelStreamWriter that simply calls theChannel.writePacket(Buffer)method.
-
-
Constructor Summary
Constructors Constructor Description DefaultChannelStreamWriter(Channel channel)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()booleanisOpen()IoWriteFuturewriteData(Buffer buffer)Encode and send the given data packet buffer.
-
-
-
Field Detail
-
channel
protected final Channel channel
-
closed
protected volatile boolean closed
-
-
Constructor Detail
-
DefaultChannelStreamWriter
public DefaultChannelStreamWriter(Channel channel)
-
-
Method Detail
-
writeData
public IoWriteFuture writeData(Buffer buffer) throws java.io.IOException
Description copied from interface:ChannelStreamWriterEncode 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:
writeDatain interfaceChannelStreamWriter- Parameters:
buffer- the buffer to encode and send. NOTE: the buffer must not be touched until the returned write future is completed.- Returns:
- An
IoWriteFuturethat can be used to check when the packet has actually been sent - Throws:
java.io.IOException- if an error occurred when encoding or sending the packet
-
isOpen
public boolean isOpen()
- Specified by:
isOpenin interfacejava.nio.channels.Channel
-
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- Throws:
java.io.IOException
-
-