Search in sources :

Example 1 with Message

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;
}
Also used : Message(edu.umass.cs.gnsserver.activecode.prototype.interfaces.Message) ActiveMessage(edu.umass.cs.gnsserver.activecode.prototype.ActiveMessage) JSONException(org.json.JSONException) ActiveMessage(edu.umass.cs.gnsserver.activecode.prototype.ActiveMessage)

Aggregations

ActiveMessage (edu.umass.cs.gnsserver.activecode.prototype.ActiveMessage)1 Message (edu.umass.cs.gnsserver.activecode.prototype.interfaces.Message)1 JSONException (org.json.JSONException)1