public class JsonConnector extends BasicConnector implements Connector
For data types other than native there is reserved form: { "__type__": "type_name",...}. This implementatoins encodes java Date() instance as
{ "__type__": "datetime", "unixtime", seconds_since_epoch }
using standard unix time - number of seconds since epoch. Note, that it can be either integer or
float to get subsecond resolution.
This class is thread safe as long as it is used properly, e.g. connected with only one endpoint
like the Farcall instance.
Created by sergeych on 12.04.16.
closed, in, out| Constructor and Description |
|---|
JsonConnector(java.io.InputStream in,
java.io.OutputStream out) |
| Modifier and Type | Method and Description |
|---|---|
java.util.Map<java.lang.String,java.lang.Object> |
receive()
Block until the connection is closed or a valid package is received.
|
void |
send(java.util.Map<java.lang.String,java.lang.Object> data)
Pack and send farcall data
|
close, isAutoClosing, isClosed, setAutoClosingfromJson, fromJson, toJson, toJsonStringpublic JsonConnector(java.io.InputStream in,
java.io.OutputStream out)
public void send(java.util.Map<java.lang.String,java.lang.Object> data)
throws java.io.IOException
Connectorpublic java.util.Map<java.lang.String,java.lang.Object> receive()
throws java.io.IOException
Connector