Package org.glassfish.tyrus.core.frame
Class Frame
java.lang.Object
org.glassfish.tyrus.core.frame.Frame
- Direct Known Subclasses:
TyrusFrame
WebSocket frame representation.
TODO: - masking (isMask is currently ignored) - validation - payloadLength is limited to int
- Author:
- Pavel Bucek
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic Frame.Builderbuilder()Create newFrame.Builder.static Frame.BuilderCreate newFrame.Builderbased on provided frame.Get masking key.byteGet opcode.byte[]Get payload data.longGet payload length.booleanGet information about frame type.booleanisFin()Get FIN value.booleanisMask()Currently not used.booleanisRsv1()GET RSV1 value.booleanisRsv2()GET RSV2 value.booleanisRsv3()GET RSV3 value.toString()
-
Constructor Details
-
Frame
Copy constructor.Note: this is shallow copy. Payload is *not* copied to new array.
- Parameters:
frame- copied frame.
-
-
Method Details
-
isFin
public boolean isFin()Get FIN value.- Returns:
truewhen FIN flag is set,falseotherwise.
-
isRsv1
public boolean isRsv1()GET RSV1 value.- Returns:
truewhen RSV1 flag is set,falseotherwise.
-
isRsv2
public boolean isRsv2()GET RSV2 value.- Returns:
truewhen RSV2 flag is set,falseotherwise.
-
isRsv3
public boolean isRsv3()GET RSV3 value.- Returns:
truewhen RSV3 flag is set,falseotherwise.
-
isMask
public boolean isMask()Currently not used.- Returns:
- not used.
-
getOpcode
public byte getOpcode()Get opcode.- Returns:
- opcode (4 bit value).
-
getPayloadLength
public long getPayloadLength()Get payload length.- Returns:
- payload length.
-
getMaskingKey
Get masking key.- Returns:
- masking key (32 bit value) or
nullwhen the frame should not be masked.
-
getPayloadData
public byte[] getPayloadData()Get payload data.Changes done to returned array won't be propagated to current
Frameinstance. If you need to modify payload, you have to create new instance, seeBuilder#Frame(Frame). Length of returned array will be always same asgetPayloadLength().- Returns:
- payload data.
-
isControlFrame
public boolean isControlFrame()Get information about frame type.- Returns:
truewhen this frame is control (close, ping, pong) frame,falseotherwise.
-
toString
-
builder
Create newFrame.Builder.- Returns:
- new builder instance.
-
builder
Create newFrame.Builderbased on provided frame.- Parameters:
frame- frame used as a base for building new frame.- Returns:
- new builder instance.
-