com.caucho.remote.websocket
Class WebSocketContextStreamImpl

java.lang.Object
  extended by com.caucho.remote.websocket.WebSocketContextStreamImpl
All Implemented Interfaces:
WebSocketConstants, WebSocketContext

public class WebSocketContextStreamImpl
extends java.lang.Object
implements WebSocketContext, WebSocketConstants

User facade for http requests.


Field Summary
 
Fields inherited from interface com.caucho.remote.websocket.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 Summary
WebSocketContextStreamImpl(WriteStream out)
           
 
Method Summary
 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.
protected  WebSocketInputStream createWebSocketInputStream(FrameInputStream is)
           
 void disconnect()
          Disconnect the connection.
 long getTimeout()
          Gets the read timeout.
protected  WriteStream getWriteStream()
           
 void pong(byte[] bytes)
          sends a pong message
 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()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

WebSocketContextStreamImpl

public WebSocketContextStreamImpl(WriteStream out)
Method Detail

setTimeout

public void setTimeout(long timeout)
Description copied from interface: WebSocketContext
Sets the read timeout.

Specified by:
setTimeout in interface WebSocketContext

getTimeout

public long getTimeout()
Description copied from interface: WebSocketContext
Gets the read timeout.

Specified by:
getTimeout in interface WebSocketContext

startBinaryMessage

public java.io.OutputStream startBinaryMessage()
                                        throws java.io.IOException
Description copied from interface: WebSocketContext
Returns the output stream for a binary message. The message will complete when the OutputStream is closed.

Specified by:
startBinaryMessage in interface WebSocketContext
Throws:
java.io.IOException

startTextMessage

public java.io.PrintWriter startTextMessage()
                                     throws java.io.IOException
Description copied from interface: WebSocketContext
Returns the output stream for a binary message. The message will complete when the Writer is closed.

Specified by:
startTextMessage in interface WebSocketContext
Throws:
java.io.IOException

pong

public void pong(byte[] bytes)
Description copied from interface: WebSocketContext
sends a pong message

Specified by:
pong in interface WebSocketContext

close

public void close()
Description copied from interface: WebSocketContext
gracefully close the connection, waiting for unread messages.

Specified by:
close in interface WebSocketContext

close

public void close(int code,
                  java.lang.String msg)
Description copied from interface: WebSocketContext
gracefully close the connection, waiting for unread messages.

Specified by:
close in interface WebSocketContext

getWriteStream

protected WriteStream getWriteStream()

disconnect

public void disconnect()
Description copied from interface: WebSocketContext
Disconnect the connection.

Specified by:
disconnect in interface WebSocketContext

createWebSocketInputStream

protected WebSocketInputStream createWebSocketInputStream(FrameInputStream is)
                                                   throws java.io.IOException
Throws:
java.io.IOException

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object