public class JsonStreamer extends VehicleMessageStreamer
| Constructor and Description |
|---|
JsonStreamer() |
| Modifier and Type | Method and Description |
|---|---|
static boolean |
containsJson(java.lang.String buffer)
Return true if the buffer *most likely* contains JSON (as opposed to a
protobuf).
|
java.lang.String |
getRawMessage() |
VehicleMessage |
parseMessage(java.lang.String line) |
VehicleMessage |
parseNextMessage()
Deserialize and return the next messages from the internally buffered
stream.
|
void |
receive(byte[] bytes,
int length)
Add additional bytes to the buffer from the data source.
|
byte[] |
serializeForStream(VehicleMessage message)
Serialize the message and insert any required delimiters for insertion
into a message stream.
|
public static boolean containsJson(java.lang.String buffer)
public VehicleMessage parseNextMessage()
VehicleMessageStreamerparseNextMessage in class VehicleMessageStreamerpublic VehicleMessage parseMessage(java.lang.String line)
parseMessage in class VehicleMessageStreamerpublic java.lang.String getRawMessage()
getRawMessage in class VehicleMessageStreamerpublic void receive(byte[] bytes,
int length)
VehicleMessageStreamerreceive in class VehicleMessageStreamerbytes - an array of bytes received from the interface.length - number of bytes received, and thus the amount that should
be read from the array.public byte[] serializeForStream(VehicleMessage message)
VehicleMessageStreamerserializeForStream in class VehicleMessageStreamermessage - the message to serialize.