public class Frame
extends java.lang.Object
TODO: - masking (isMask is currently ignored) - validation - payloadLength is limited to int
Modifier and Type | Class and Description |
---|---|
static class |
Frame.Builder
Frame builder.
|
Modifier | Constructor and Description |
---|---|
protected |
Frame(Frame frame)
Copy constructor.
|
Modifier and Type | Method and Description |
---|---|
static Frame.Builder |
builder()
Create new
Frame.Builder . |
static Frame.Builder |
builder(Frame frame)
Create new
Frame.Builder based on provided frame. |
java.lang.Integer |
getMaskingKey()
Get masking key.
|
byte |
getOpcode()
Get opcode.
|
byte[] |
getPayloadData()
Get payload data.
|
long |
getPayloadLength()
Get payload length.
|
boolean |
isControlFrame()
Get information about frame type.
|
boolean |
isFin()
Get FIN value.
|
boolean |
isMask()
Currently not used.
|
boolean |
isRsv1()
GET RSV1 value.
|
boolean |
isRsv2()
GET RSV2 value.
|
boolean |
isRsv3()
GET RSV3 value.
|
java.lang.String |
toString() |
protected Frame(Frame frame)
Note: this is shallow copy. Payload is *not* copied to new array.
frame
- copied frame.public boolean isFin()
true
when FIN flag is set, false
otherwise.public boolean isRsv1()
true
when RSV1 flag is set, false
otherwise.public boolean isRsv2()
true
when RSV2 flag is set, false
otherwise.public boolean isRsv3()
true
when RSV3 flag is set, false
otherwise.public boolean isMask()
public byte getOpcode()
public long getPayloadLength()
public java.lang.Integer getMaskingKey()
null
when the frame should not be masked.public byte[] getPayloadData()
Changes done to returned array won't be propagated to current Frame
instance. If you need to modify
payload, you have to create new instance, see Builder#Frame(Frame)
. Length of returned array will
be always same as getPayloadLength()
.
public boolean isControlFrame()
true
when this frame is control (close, ping, pong) frame, false
otherwise.public java.lang.String toString()
toString
in class java.lang.Object
public static Frame.Builder builder()
Frame.Builder
.public static Frame.Builder builder(Frame frame)
Frame.Builder
based on provided frame.frame
- frame used as a base for building new frame.Copyright © 2012–2020 Oracle Corporation. All rights reserved.