Simplified the serialisation format. Other task #39.

The new format is simpler but less efficient for small integers, short
strings and short byte arrays.
This commit is contained in:
akwizgran
2014-01-14 22:40:47 +00:00
parent 8886d954d7
commit db96994d5c
15 changed files with 314 additions and 680 deletions

View File

@@ -218,13 +218,13 @@ abstract class Connector extends Thread {
}
protected void sendTimestamp(Writer w, long timestamp) throws IOException {
w.writeInt64(timestamp);
w.writeInteger(timestamp);
w.flush();
if(LOG.isLoggable(INFO)) LOG.info(pluginName + " sent timestamp");
}
protected long receiveTimestamp(Reader r) throws IOException {
long timestamp = r.readInt64();
long timestamp = r.readInteger();
if(timestamp < 0) throw new FormatException();
if(LOG.isLoggable(INFO)) LOG.info(pluginName + " received timestamp");
return timestamp;