public class MessageWriter
extends java.io.Writer
Writer
Note: Per WebSocket spec, all WebSocket TEXT messages must be encoded in UTF-8
Modifier and Type | Field and Description |
---|---|
private BlockingWriteCallback |
blocker |
private java.nio.ByteBuffer |
buffer |
private ByteBufferPool |
bufferPool |
private WriteCallback |
callback |
private boolean |
closed |
private TextFrame |
frame |
private long |
frameCount |
private static Logger |
LOG |
private OutgoingFrames |
outgoing |
private Utf8CharBuffer |
utf |
Constructor and Description |
---|
MessageWriter(OutgoingFrames outgoing,
int bufferSize,
ByteBufferPool bufferPool) |
MessageWriter(WebSocketSession session) |
Modifier and Type | Method and Description |
---|---|
void |
close() |
void |
flush() |
private void |
flush(boolean fin) |
private void |
notifyFailure(java.lang.Throwable failure) |
private void |
notifySuccess() |
private void |
send(char[] chars,
int offset,
int length) |
void |
setCallback(WriteCallback callback) |
void |
write(char[] chars,
int off,
int len) |
void |
write(int c) |
private static final Logger LOG
private final OutgoingFrames outgoing
private final ByteBufferPool bufferPool
private final BlockingWriteCallback blocker
private long frameCount
private TextFrame frame
private java.nio.ByteBuffer buffer
private Utf8CharBuffer utf
private WriteCallback callback
private boolean closed
public MessageWriter(WebSocketSession session)
public MessageWriter(OutgoingFrames outgoing, int bufferSize, ByteBufferPool bufferPool)
public void write(char[] chars, int off, int len) throws java.io.IOException
write
in class java.io.Writer
java.io.IOException
public void write(int c) throws java.io.IOException
write
in class java.io.Writer
java.io.IOException
public void flush() throws java.io.IOException
flush
in interface java.io.Flushable
flush
in class java.io.Writer
java.io.IOException
public void close() throws java.io.IOException
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
close
in class java.io.Writer
java.io.IOException
private void flush(boolean fin) throws java.io.IOException
java.io.IOException
private void send(char[] chars, int offset, int length) throws java.io.IOException
java.io.IOException
public void setCallback(WriteCallback callback)
private void notifySuccess()
private void notifyFailure(java.lang.Throwable failure)