public class WSFrame
extends java.lang.Object
Modifier and Type | Method | Description |
---|---|---|
byte[] |
getMaskArray() |
Gets the mask as a byte array.
|
int |
getMaskValue() |
Gets the int used to mask this payload.
|
int |
getOpCode() |
The opCode for this websocket frame.
|
long |
getPayloadDataLength() |
Returns the size of the websocket frames payload
|
java.nio.ByteBuffer |
getRawFrame() |
ByteBuffer for the raw frame.
|
boolean |
hasMask() |
Is the mask bit set for this WSFrames payload.
|
boolean |
hasRSV1() |
Is the RSV1 bit set.
|
boolean |
hasRSV2() |
Is the RSV2 bit set.
|
boolean |
hasRSV3() |
Is the RSV3 bit set.
|
boolean |
isFinished() |
Is the finished bit set in the frame.
|
static WSFrame |
makeWSFrame(int size,
boolean isFinished,
byte opCode,
boolean mask) |
Creates a
WSFrame object with the provided parameters. |
static WSFrame |
makeWSFrame(int size,
byte opCode,
boolean mask) |
Creates a
WSFrame object with the provided parameters. |
static WSFrame |
makeWSFrame(int size,
WSOPCode opCode,
boolean mask) |
Creates a
WSFrame object with the provided parameters. |
static WSFrame |
parseWSFrame(java.nio.ByteBuffer bb) |
Parses a WebSocket frame out of the provided
ByteBuffer . |
static WSFrame |
parseWSFrame(org.threadly.litesockets.buffers.MergedByteBuffers mbb) |
Parses a WebSocket frame from the passed in
MergedByteBuffers . |
java.nio.ByteBuffer |
unmaskPayload(java.nio.ByteBuffer nbb) |
Takes a ByteBuffer if this WSFrames payload and unmasks it.
|
public java.nio.ByteBuffer getRawFrame()
public boolean isFinished()
public boolean hasRSV1()
public boolean hasRSV2()
public boolean hasRSV3()
public int getOpCode()
public boolean hasMask()
public long getPayloadDataLength()
public int getMaskValue()
public byte[] getMaskArray()
public java.nio.ByteBuffer unmaskPayload(java.nio.ByteBuffer nbb)
nbb
- the ByteBuffer payload of this WSFrame.public static WSFrame parseWSFrame(java.nio.ByteBuffer bb) throws java.text.ParseException
ByteBuffer
.public static WSFrame parseWSFrame(org.threadly.litesockets.buffers.MergedByteBuffers mbb) throws java.text.ParseException
MergedByteBuffers
. Only the data for the frame
will be parsed out of the ByteBuffer, the payload will remain.public static WSFrame makeWSFrame(int size, byte opCode, boolean mask)
WSFrame
object with the provided parameters.size
- the size of the payload in the WebSocket Frame.opCode
- The opCode to put in this WebSocket.mask
- true if a mask should be added to this frame, false if not.WSFrame
object created with the provided params.public static WSFrame makeWSFrame(int size, WSOPCode opCode, boolean mask)
WSFrame
object with the provided parameters.public static WSFrame makeWSFrame(int size, boolean isFinished, byte opCode, boolean mask)
WSFrame
object with the provided parameters.size
- the size of the payload in the WSFrame.isFinished
- true if we should mark this WSFrame as finished false if not.opCode
- The opCode to put in this WebSocket.mask
- true if a mask should be added to this frame, false if not.WSFrame
object created with the provided params.