public class WebSocketFrame extends Object
| Modifier and Type | Field and Description |
|---|---|
static int |
frameLengthOverhead |
| Constructor and Description |
|---|
WebSocketFrame(byte[] rawFrame)
Initialise WebSocketFrame from raw Data
|
WebSocketFrame(byte opcode,
boolean fin,
byte[] payload)
Initialise a new WebSocketFrame
|
WebSocketFrame(InputStream input)
Takes an input stream and parses it into a Websocket frame.
|
| Modifier and Type | Method and Description |
|---|---|
static void |
appendFinAndOpCode(ByteBuffer buffer,
byte opcode,
boolean fin)
Appends the Fin flag and the OpCode
|
static void |
appendLengthAndMask(ByteBuffer buffer,
int length,
byte[] mask)
Appends the Length and Mask to the buffer
|
byte[] |
encodeFrame()
Encodes the this WebSocketFrame into a byte array.
|
static byte[] |
generateMaskingKey()
Generates a random masking key
Nothing super secure, but enough
for websockets.
|
byte |
getOpcode() |
byte[] |
getPayload() |
boolean |
isCloseFlag() |
boolean |
isFin() |
public static final int frameLengthOverhead
public WebSocketFrame(byte opcode,
boolean fin,
byte[] payload)
opcode - fin - payload - public WebSocketFrame(byte[] rawFrame)
rawFrame - public WebSocketFrame(InputStream input) throws IOException
input - IOExceptionpublic byte getOpcode()
public boolean isFin()
public byte[] getPayload()
public boolean isCloseFlag()
public byte[] encodeFrame()
public static void appendLengthAndMask(ByteBuffer buffer, int length, byte[] mask)
buffer - length - mask - public static void appendFinAndOpCode(ByteBuffer buffer, byte opcode, boolean fin)
buffer - opcode - fin - public static byte[] generateMaskingKey()
Copyright © 2017 Eclipse Paho. All Rights Reserved.