public class DefaultChannelStreamWriter extends java.lang.Object implements ChannelStreamWriter
Channel.writePacket(Buffer)
method.Modifier and Type | Field and Description |
---|---|
protected Channel |
channel |
protected boolean |
closed |
Constructor and Description |
---|
DefaultChannelStreamWriter(Channel channel) |
Modifier and Type | Method and Description |
---|---|
void |
close() |
boolean |
isOpen() |
IoWriteFuture |
writeData(Buffer buffer)
Encode and send the given data packet buffer.
|
protected final Channel channel
protected volatile boolean closed
public DefaultChannelStreamWriter(Channel channel)
public IoWriteFuture writeData(Buffer buffer) throws java.io.IOException
ChannelStreamWriter
writeData
in interface ChannelStreamWriter
buffer
- the buffer to encode and send. NOTE: the buffer must not be touched until the returned
write future is completed.IoWriteFuture
that can be used to check when the packet has actually been sentjava.io.IOException
- if an error occurred when encoding or sending the packetpublic boolean isOpen()
isOpen
in interface java.nio.channels.Channel
public void close() throws java.io.IOException
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
close
in interface java.nio.channels.Channel
java.io.IOException