public class WebSocketContextStreamImpl extends java.lang.Object implements WebSocketContext, WebSocketConstants
CLOSE_ERROR, CLOSE_MESSAGE_TOO_BIG, CLOSE_OK, CLOSE_UTF8, FLAG_FIN, FLAG_MASK, MASK_OPCODE, OP_BINARY, OP_CLOSE, OP_CONT, OP_PING, OP_PONG, OP_TEXT, VERSION| Constructor and Description |
|---|
WebSocketContextStreamImpl(WriteStream out) |
| Modifier and Type | Method and Description |
|---|---|
void |
close()
gracefully close the connection, waiting for unread messages.
|
void |
close(int code,
java.lang.String msg)
gracefully close the connection, waiting for unread messages.
|
<T> java.util.concurrent.BlockingQueue<T> |
createOutputQueue(WebSocketEncoder<T> encoder)
Creates a thread-safe queue, which applications can send objects to be
marshaled.
|
protected WebSocketInputStream |
createWebSocketInputStream(FrameInputStream is) |
void |
disconnect()
Disconnect the connection.
|
void |
flush()
flushes the output stream
|
long |
getTimeout()
Gets the read timeout.
|
protected WriteStream |
getWriteStream() |
boolean |
isAutoFlush()
returns the current flush mode.
|
void |
onClose(int closeCode,
java.lang.String closeMessage) |
void |
pong(byte[] bytes)
sends a pong message
|
void |
setAutoFlush(boolean isAutoFlush)
auto-flush after each message is sent.
|
void |
setTimeout(long timeout)
Sets the read timeout.
|
java.io.OutputStream |
startBinaryMessage()
Returns the output stream for a binary message.
|
java.io.PrintWriter |
startTextMessage()
Returns the output stream for a binary message.
|
java.lang.String |
toString() |
public WebSocketContextStreamImpl(WriteStream out)
public void setTimeout(long timeout)
WebSocketContextsetTimeout in interface WebSocketContextpublic long getTimeout()
WebSocketContextgetTimeout in interface WebSocketContextpublic java.io.OutputStream startBinaryMessage()
throws java.io.IOException
WebSocketContextstartBinaryMessage in interface WebSocketContextjava.io.IOExceptionpublic java.io.PrintWriter startTextMessage()
throws java.io.IOException
WebSocketContextstartTextMessage in interface WebSocketContextjava.io.IOExceptionpublic void pong(byte[] bytes)
WebSocketContextpong in interface WebSocketContextpublic void close()
WebSocketContextclose in interface WebSocketContextpublic void close(int code,
java.lang.String msg)
WebSocketContextclose in interface WebSocketContextprotected WriteStream getWriteStream()
public void disconnect()
WebSocketContextdisconnect in interface WebSocketContextpublic void flush()
throws java.io.IOException
WebSocketContextflush in interface WebSocketContextjava.io.IOExceptionprotected WebSocketInputStream createWebSocketInputStream(FrameInputStream is) throws java.io.IOException
java.io.IOExceptionpublic void onClose(int closeCode,
java.lang.String closeMessage)
onClose in interface WebSocketContextpublic java.lang.String toString()
toString in class java.lang.Objectpublic <T> java.util.concurrent.BlockingQueue<T> createOutputQueue(WebSocketEncoder<T> encoder)
WebSocketContextcreateOutputQueue in interface WebSocketContextpublic void setAutoFlush(boolean isAutoFlush)
WebSocketContextsetAutoFlush in interface WebSocketContextpublic boolean isAutoFlush()
WebSocketContextisAutoFlush in interface WebSocketContext