public final class CipherFrameHeaders extends Object
It contains the following fields in order:
Constructor and Description |
---|
CipherFrameHeaders()
Default constructor.
|
CipherFrameHeaders(int sequenceNumber,
byte[] nonce,
int frameContentLen,
boolean isFinal)
Construct the frame headers using the provided sequence number, nonce, length of content, and
boolean value indicating if it is the final frame.
|
Modifier and Type | Method and Description |
---|---|
int |
deserialize(byte[] b,
int off)
Deserialize the provided bytes starting at the specified offset to construct an instance of
this class.
|
int |
getFrameContentLength()
Return the frame content length set in the frame header.
|
byte[] |
getNonce()
Return the nonce set in the frame header.
|
int |
getSequenceNumber()
Return the frame sequence number set in the frame header.
|
void |
includeFrameSize(boolean value)
Set the flag to specify whether the frame length needs to be included or parsed in the header.
|
boolean |
isComplete()
Check if this object has all the header fields populated and available for reading.
|
boolean |
isFinalFrame()
Return if the frame is a final frame.
|
void |
setNonceLength(short nonceLength)
Set the length of the nonce used in the encryption of the content in the frame.
|
byte[] |
toByteArray()
Serialize the header into a byte array.
|
public CipherFrameHeaders()
public CipherFrameHeaders(int sequenceNumber, byte[] nonce, int frameContentLen, boolean isFinal)
sequenceNumber
- the sequence number of the framenonce
- the bytes containing the nonce.frameContentLen
- the length of the content in the frame.isFinal
- boolean value indicating if it is the final frame.public byte[] toByteArray()
public int deserialize(byte[] b, int off)
This method parses the provided bytes for the individual fields in this class. This methods also supports partial parsing where not all the bytes required for parsing the fields successfully are available.
b
- the byte array to deserialize.off
- the offset in the byte array to use for deserialization.public boolean isFinalFrame()
public boolean isComplete()
public byte[] getNonce()
public int getFrameContentLength()
public int getSequenceNumber()
public void setNonceLength(short nonceLength)
nonceLength
- the length of the nonce used in the encryption of the content in the frame.public void includeFrameSize(boolean value)
value
- true if the frame length needs to be included or parsed in the header; false
otherwiseCopyright © 2023. All rights reserved.