public class AggregatedTextFrame extends TextFrame implements IAggregatedFrame
| Constructor and Description |
|---|
AggregatedTextFrame(boolean finalFragment,
int rsvBits,
byte[] payload)
Constructs an aggregated Web Socket text frame.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addFragment(byte[] payload)
Adds a new payload data fragment for future aggregation.
|
List<byte[]> |
getFragments()
Returns all payload data fragments already stored in this frame.
|
byte[] |
getPayload()
Returns the payload data in this frame.
|
int |
getPayloadLength()
Return the length of the payload data in this frame.
|
static String |
toText(byte[] fragment)
Returns a text created by decoding the specified array of bytes in the UTF-8
encoding.
|
getOpcode, getRsvBits, isFinalFragment, isRsvBit1, isRsvBit2, isRsvBit3public AggregatedTextFrame(boolean finalFragment,
int rsvBits,
byte[] payload)
NOTE: The binary data in the payload argument should be a valid UTF-8
encoding.
finalFragment - determines if the created frame is the final fragment in
a messagersvBits - reserved bits for extensions or future versionspayload - payload datapublic void addFragment(byte[] payload)
NOTE: The binary data in the payload argument should be a valid UTF-8
encoding.
addFragment in interface IAggregatedFramepayload - the new payload data fragmentpublic List<byte[]> getFragments()
IAggregatedFrame
NOTE: It is expected that, due to possible optimizations, the number of
return fragments may change after executing of the IAggregatedFrame.getPayload()
method. However, in such a case, the aggregated payload data should
still be the same.
getFragments in interface IAggregatedFramepublic int getPayloadLength()
FramegetPayloadLength in interface IAggregatedFramegetPayloadLength in class Framepublic byte[] getPayload()
FramegetPayload in interface IAggregatedFramegetPayload in class Framepublic static String toText(byte[] fragment)
fragment - the array of bytes to decode the text fromCopyright © 2017–2022 SNF4J.ORG. All rights reserved.