-
- All Implemented Interfaces:
public class ChannelData
The ChannelData message are used in TURN protocol after a client has bound a channel to a peer. 0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Channel Number | Length | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | | / Application Data / / / | | | +-------------------------------+ | | +-------------------------------+
-
-
Field Summary
Fields Modifier and Type Field Description private char
channelNumber
private Array<byte>
data
public static char
HEADER_LENGTH
-
Constructor Summary
Constructors Constructor Description ChannelData()
Constructor.
-
Method Summary
Modifier and Type Method Description char
getChannelNumber()
Get the channel number. void
setChannelNumber(char channelNumber)
Set the channel number Array<byte>
getData()
Get the data. void
setData(Array<byte> data)
Set the data. char
getDataLength()
Get the data length (without padding). Array<byte>
encode()
Returns a non padded binary representation of this message. Array<byte>
encode(boolean pad)
Returns a binary representation of this message. static ChannelData
decode(Array<byte> binMessage, char offset, char arrayLen)
Constructs a message from its binary representation. static ChannelData
decode(Array<byte> binMessage, char offset)
Constructs a message from its binary representation. static boolean
isChannelDataMessage(Array<byte> binMessage)
Checks if the given binary message is a ChannelData Message. -
-
Method Detail
-
getChannelNumber
char getChannelNumber()
Get the channel number.
-
setChannelNumber
void setChannelNumber(char channelNumber)
Set the channel number
- Parameters:
channelNumber
- the channel number
-
getDataLength
char getDataLength()
Get the data length (without padding).
-
encode
Array<byte> encode(boolean pad)
Returns a binary representation of this message.
- Parameters:
pad
- determine if we pad this message
-
decode
static ChannelData decode(Array<byte> binMessage, char offset, char arrayLen)
Constructs a message from its binary representation.
- Parameters:
binMessage
- the binary array that contains the encoded messageoffset
- the index where the message starts.arrayLen
- the length of the message
-
decode
static ChannelData decode(Array<byte> binMessage, char offset)
Constructs a message from its binary representation.
- Parameters:
binMessage
- the binary array that contains the encoded messageoffset
- the index where the message starts.
-
isChannelDataMessage
static boolean isChannelDataMessage(Array<byte> binMessage)
Checks if the given binary message is a ChannelData Message. Every ChannelData message has first two bits as 01.
- Parameters:
binMessage
- binary message to check.
-
-
-
-