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()
VehicleMessageStreamer
parseNextMessage
in class VehicleMessageStreamer
public VehicleMessage parseMessage(java.lang.String line)
parseMessage
in class VehicleMessageStreamer
public java.lang.String getRawMessage()
getRawMessage
in class VehicleMessageStreamer
public void receive(byte[] bytes, int length)
VehicleMessageStreamer
receive
in class VehicleMessageStreamer
bytes
- 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)
VehicleMessageStreamer
serializeForStream
in class VehicleMessageStreamer
message
- the message to serialize.