YAACC - UPNP Client and Server
Loading...
Searching...
No Matches
de.yaacc.snapcast.control.SnapcastLineReader Class Reference

Reads newline-terminated lines from a stream at the byte level (not readLine(), which would buffer a line of any length): a line is capped at maxLineBytes and must be finished within lineDeadlineMillis of its first byte, so a server can neither fill the memory nor keep the reader busy with a line that never ends. More...

Collaboration diagram for de.yaacc.snapcast.control.SnapcastLineReader:
Collaboration graph

Public Member Functions

 SnapcastLineReader (InputStream in, int maxLineBytes, long lineDeadlineMillis, MonotonicClock clock)
 
byte[] readLine () throws IOException, SnapcastException
 

Detailed Description

Reads newline-terminated lines from a stream at the byte level (not readLine(), which would buffer a line of any length): a line is capped at maxLineBytes and must be finished within lineDeadlineMillis of its first byte, so a server can neither fill the memory nor keep the reader busy with a line that never ends.

Member Function Documentation

◆ readLine()

byte[] de.yaacc.snapcast.control.SnapcastLineReader.readLine ( ) throws IOException, SnapcastException
Returns
the next line without its terminator (\n or \r\n), or null at the end of the stream (a last line without a terminator is dropped)
Exceptions
SocketTimeoutExceptionwhen nothing arrived within the read timeout and no line is under way (idle)
SnapcastExceptionLIMIT when the line is longer than the cap; TIMEOUT when a line under way stalls or takes longer than the deadline
IOExceptionthe stream failed

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