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
 int available()
           
 void close()
           
 long getLength()
           
 void init()
           
 int read()
           
 int read(byte[] buffer, int offset, int length)
           
 long skip(long length)
           
 boolean startBinaryMessage()
           
 
Methods inherited from class java.io.InputStream
mark, markSupported, read, reset
 
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)
Method Detail

init

public void init()

startBinaryMessage

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

getLength

public long getLength()

available

public int available()
Overrides:
available in class java.io.InputStream

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

skip

public long skip(long length)
          throws java.io.IOException
Overrides:
skip in class java.io.InputStream
Throws:
java.io.IOException

close

public void close()
           throws java.io.IOException
Specified by:
close in interface java.io.Closeable
Overrides:
close in class java.io.InputStream
Throws:
java.io.IOException