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

One JSON-RPC 2.0 message from the server: an answer to a call (a result or an error), a notification, or (not supported, ignored by the connection) a request of the server. More...

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

Classes

enum  Type
 

Public Member Functions

Type getType ()
 
Long getId ()
 The id of an answer (or request); null when it has none or none we could have made.
 
String getMethod ()
 The method of a notification or request; null for an answer.
 
JSONObject getParams ()
 The parameters of a notification or request; an empty object when there are none, null for an answer.
 
JSONObject getResult ()
 The result of an answer; an empty object when the server sent something else; null for the other types.
 
SnapcastException getError ()
 The error of an answer, or null.
 

Static Public Member Functions

static List< SnapcastMessage > parseLine (String line) throws SnapcastException
 Reads a line with the default batch limit.
 
static List< SnapcastMessage > parseLine (String line, int maxBatch) throws SnapcastException
 Reads one line: a message, or a batch of at most maxBatch messages.
 

Detailed Description

One JSON-RPC 2.0 message from the server: an answer to a call (a result or an error), a notification, or (not supported, ignored by the connection) a request of the server.

A line holds one message or a batch of them.

Member Function Documentation

◆ parseLine()

static List< SnapcastMessage > de.yaacc.snapcast.control.SnapcastMessage.parseLine ( String line,
int maxBatch ) throws SnapcastException
static

Reads one line: a message, or a batch of at most maxBatch messages.

Elements of a batch that are no messages are skipped; a line without a single message is an error.

Exceptions
SnapcastExceptionof kind MALFORMED (not JSON, not a message, empty batch) or LIMIT (too long, too big a batch, too deep, too many tokens)

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