WebSocketFrame
public WebSocketFrame(byte[] rawFrame)
Initialise WebSocketFrame from raw Data
Parameters:
rawFrame
-
public WebSocketFrame(java.io.InputStream input)
throws java.io.IOException
Takes an input stream and parses it into a Websocket frame.
Parameters:
input
-
Throws:
java.io.IOException
appendLengthAndMask
public static void appendLengthAndMask(java.nio.ByteBuffer buffer,
int length,
byte[] mask)
Appends the Length and Mask to the buffer
Parameters:
buffer
-
length
-
mask
-
appendFinAndOpCode
public static void appendFinAndOpCode(java.nio.ByteBuffer buffer,
byte opcode,
boolean fin)
Appends the Fin flag and the OpCode
Parameters:
buffer
-
opcode
-
fin
-
generateMaskingKey
public static byte[] generateMaskingKey()
Generates a random masking key
Nothing super secure, but enough
for websockets.
Returns:
ByteArray containing the key;