YAACC - UPNP Client and Server
Loading...
Searching...
No Matches
de.yaacc.fcast.protocol.FCastPacketCodec Class Reference

The framing of FCast protocol v3: a little-endian 32 bit size that counts the opcode and the body, one opcode byte, then the body (UTF-8 JSON, may be absent). More...

Collaboration diagram for de.yaacc.fcast.protocol.FCastPacketCodec:
Collaboration graph

Static Public Member Functions

static byte[] encodeBinary (int opcode, byte[] body, int maxPacket) throws FCastProtocolException
 A packet with a binary body (version 4).
 
static byte[] encode (int opcode, String body) throws FCastProtocolException
 

Static Public Attributes

static final int MAX_PACKET = 32000
 The most bytes of a packet after the size field: the opcode and the body.
 
static final int MAX_BODY = MAX_PACKET - 1
 The most bytes of a body.
 
static final int MAX_PACKET_V4 = 512 * 1024
 The most bytes of a packet of version 4 (after the size field).
 

Detailed Description

The framing of FCast protocol v3: a little-endian 32 bit size that counts the opcode and the body, one opcode byte, then the body (UTF-8 JSON, may be absent).

A whole packet is 32000 bytes at most (the limit of the Android receiver, the desktop receiver skips what is larger). Pure; the reading side is FCastFrameReader.

Member Function Documentation

◆ encode()

static byte[] de.yaacc.fcast.protocol.FCastPacketCodec.encode ( int opcode,
String body ) throws FCastProtocolException
static
Parameters
opcodethe wire value of the opcode (0 to 255)
bodythe JSON text, or null for a packet without body
Returns
the bytes to write
Exceptions
FCastProtocolExceptionTOO_LARGE if the packet would be over the limit (nothing is cut: a message that does not fit is refused by the caller)

◆ encodeBinary()

static byte[] de.yaacc.fcast.protocol.FCastPacketCodec.encodeBinary ( int opcode,
byte[] body,
int maxPacket ) throws FCastProtocolException
static

A packet with a binary body (version 4).

Exceptions
FCastProtocolExceptionTOO_LARGE if it is over maxPacket

Referenced by de.yaacc.fcast.protocol.FCastConnection.connect(), de.yaacc.fcast.protocol.FCastConnection.send(), and de.yaacc.fcast.protocol.FCastConnection.sendV4().

Here is the caller graph for this function:

The documentation for this class was generated from the following file: