public class DataFrame extends Object implements Frame
DataFrame
object represents a frame as defined in
RFC 6455. A frame is a very lightweight envelope used to send
control information and either text or binary user data. Typically
a frame will represent a single message however, it is possible
to fragment a single frame up in to several frames. A fragmented
frame has a specific FrameType
indicating that it
is a continuation frame.Data
Constructor and Description |
---|
DataFrame(FrameType type)
Constructor for the
DataFrame object. |
DataFrame(FrameType type,
byte[] data)
Constructor for the
DataFrame object. |
DataFrame(FrameType type,
byte[] data,
boolean last)
Constructor for the
DataFrame object. |
DataFrame(FrameType type,
Data data)
Constructor for the
DataFrame object. |
DataFrame(FrameType type,
Data data,
boolean last)
Constructor for the
DataFrame object. |
DataFrame(FrameType type,
String text)
Constructor for the
DataFrame object. |
DataFrame(FrameType type,
String text,
boolean last)
Constructor for the
DataFrame object. |
Modifier and Type | Method and Description |
---|---|
byte[] |
getBinary()
This returns the binary payload that is to be sent with the frame.
|
Frame |
getFrame(FrameType type)
This method is used to convert from one frame type to another.
|
String |
getText()
This returns the text payload that is to be sent with the frame.
|
FrameType |
getType()
This is used to determine the type of frame.
|
boolean |
isFinal()
This is used to determine if the frame is the final frame in
a sequence of fragments or a whole frame.
|
String |
toString()
This returns the text payload that is to be sent with the frame.
|
public DataFrame(FrameType type)
DataFrame
object. This is used
to create a frame using the specified data and frame type. A
zero payload is created using this constructor and is suitable
only for specific control frames such as connection termination.type
- this is the frame type used for this instancepublic DataFrame(FrameType type, byte[] data)
DataFrame
object. This is used
to create a frame using the specified data and frame type. In
some cases a control frame may require a zero length payload.type
- this is the frame type used for this instancedata
- this is the payload for this framepublic DataFrame(FrameType type, byte[] data, boolean last)
DataFrame
object. This is used
to create a frame using the specified data and frame type. In
some cases a control frame may require a zero length payload.type
- this is the frame type used for this instancedata
- this is the payload for this framelast
- true if this is not a fragment in a sequencepublic DataFrame(FrameType type, String text)
DataFrame
object. This is used
to create a frame using the specified data and frame type. In
some cases a control frame may require a zero length payload.type
- this is the frame type used for this instancedata
- this is the payload for this framepublic DataFrame(FrameType type, String text, boolean last)
DataFrame
object. This is used
to create a frame using the specified data and frame type. In
some cases a control frame may require a zero length payload.type
- this is the frame type used for this instancedata
- this is the payload for this framelast
- true if this is not a fragment in a sequencepublic DataFrame(FrameType type, Data data)
DataFrame
object. This is used
to create a frame using the specified data and frame type. In
some cases a control frame may require a zero length payload.type
- this is the frame type used for this instancedata
- this is the payload for this framepublic DataFrame(FrameType type, Data data, boolean last)
DataFrame
object. This is used
to create a frame using the specified data and frame type. In
some cases a control frame may require a zero length payload.type
- this is the frame type used for this instancedata
- this is the payload for this framelast
- true if this is not a fragment in a sequencepublic boolean isFinal()
public byte[] getBinary()
public String getText()
public Frame getFrame(FrameType type)
public FrameType getType()
public String toString()
Copyright © 2022. All rights reserved.