use of edu.umass.cs.gnsserver.activecode.prototype.interfaces.Message in project GNS by MobilityFirst.
the class ActiveNamedPipe method receiveMessage.
@Override
public Message receiveMessage() throws IOException {
Message am = null;
int len = -1;
if (reader != null)
len = reader.read(readerLengthBuffer, 0, readerLengthBuffer.length);
if (len > 0) {
int length = ByteBuffer.wrap(readerLengthBuffer).getInt();
byte[] buffer = new byte[length];
reader.read(buffer, 0, length);
try {
am = new ActiveMessage(buffer);
} catch (JSONException e) {
//e.printStackTrace();
}
}
return am;
}
Aggregations