|
YAACC - UPNP Client and Server
|
Reads the packets of FCast protocol v3 from a stream (see FCastPacketCodec).
More...

Public Member Functions | |
| FCastFrameReader (InputStream in) | |
The reader of versions 1 to 3: packets of at most FCastPacketCodec#MAX_PACKET bytes, every body is text. | |
| FCastFrameReader (InputStream in, int maxPacket, boolean binaryFlatbuf) | |
| FCastPacket | read () throws IOException |
Reads the packets of FCast protocol v3 from a stream (see FCastPacketCodec).
The stream may deliver any number of bytes per read; a packet is assembled from as many reads as it takes. Not thread safe: one reader thread.
Rules (the receivers end the connection on the same): a size of 0 (EMPTY_PACKET), a size over FCastPacketCodec#MAX_PACKET (OVERSIZE; nothing of the body is read, no memory is allocated for it) and a stream that ends inside a packet (TRUNCATED) are errors that end the connection; a stream that ends between two packets is the normal end. A body that is not valid UTF-8 is BAD_BODY, which does not end the connection (the packet was read completely). An unknown opcode is returned like any other: the caller skips it.
| de.yaacc.fcast.protocol.FCastFrameReader.FCastFrameReader | ( | InputStream | in, |
| int | maxPacket, | ||
| boolean | binaryFlatbuf ) |
| maxPacket | the most bytes after the size field (FCastPacketCodec#MAX_PACKET_V4 for version 4) |
| binaryFlatbuf | true for version 4: the bodies of the Flatbuf and Resource opcodes are bytes, not text |
| FCastPacket de.yaacc.fcast.protocol.FCastFrameReader.read | ( | ) | throws IOException |
| FCastProtocolException | for the cases above |
| IOException | if the stream fails (including a timeout set on a socket) |