com.caucho.remote.websocket
Class WebSocketInputStream

java.lang.Object
  extended by java.io.InputStream
      extended by com.caucho.remote.websocket.WebSocketInputStream
All Implemented Interfaces:
WebSocketConstants, java.io.Closeable
Direct Known Subclasses:
WebSocketMaskedInputStream

public class WebSocketInputStream
extends java.io.InputStream
implements WebSocketConstants

WebSocketInputStream reads a single WebSocket packet.

 +-+------+---------+-+---------+
 |F|xxx(3)|opcode(4)|R|len(7)   |
 +-+------+---------+-+---------+
 
 OPCODES
   0 - cont
   1 - close
   2 - ping
   3 - pong
   4 - text
   5 - binary
 


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
WebSocketInputStream(FrameInputStream is)
           
 
Method Summary
 long getLength()
           
 void init()
           
 int read()
           
 int read(byte[] buffer, int offset, int length)
           
 boolean startBinaryMessage()
           
 
Methods inherited from class java.io.InputStream
available, close, mark, markSupported, read, reset, skip
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WebSocketInputStream

public WebSocketInputStream(FrameInputStream is)
                     throws java.io.IOException
Throws:
java.io.IOException
Method Detail

init

public void init()

startBinaryMessage

public boolean startBinaryMessage()
                           throws java.io.IOException
Throws:
java.io.IOException

getLength

public long getLength()

read

public int read()
         throws java.io.IOException
Specified by:
read in class java.io.InputStream
Throws:
java.io.IOException

read

public int read(byte[] buffer,
                int offset,
                int length)
         throws java.io.IOException
Overrides:
read in class java.io.InputStream
Throws:
java.io.IOException