public UNSUBSCRIBE decode(MQTTFrame frame) throws ProtocolException { assert(frame.buffers.length == 1); header(frame.header()); DataByteArrayInputStream is = new DataByteArrayInputStream(frame.buffers[0]); messageId = is.readShort(); ArrayList<UTF8Buffer> list = new ArrayList<UTF8Buffer>(); while(is.available() > 0) { list.add(MessageSupport.readUTF(is)); } topics = list.toArray(new UTF8Buffer[list.size()]); return this; }
DataByteArrayInputStream is = new DataByteArrayInputStream(frame.buffers[0]); UTF8Buffer protocolName = MessageSupport.readUTF(is); if (V4_PROTOCOL_NAME.equals(protocolName)) { version = is.readByte() & 0xFF; clientId = MessageSupport.readUTF(is); if( clientId.length == 0 ) { clientId = null; willTopic = MessageSupport.readUTF(is); willMessage = MessageSupport.readUTF(is); userName = MessageSupport.readUTF(is); password = MessageSupport.readUTF(is);
public SUBSCRIBE decode(MQTTFrame frame) throws ProtocolException { assert(frame.buffers.length == 1); header(frame.header()); DataByteArrayInputStream is = new DataByteArrayInputStream(frame.buffers[0]); QoS qos = qos(); if(qos != QoS.AT_MOST_ONCE) { messageId = is.readShort(); } ArrayList<Topic> list = new ArrayList<Topic>(); while(is.available() > 0) { Topic topic = new Topic(MessageSupport.readUTF(is), QoS.values()[is.readByte()]); list.add(topic); } topics = list.toArray(new Topic[list.size()]); return this; }
public PUBLISH decode(MQTTFrame frame) throws ProtocolException { assert(frame.buffers.length == 1); header(frame.header()); DataByteArrayInputStream is = new DataByteArrayInputStream(frame.buffers[0]); topicName = MessageSupport.readUTF(is); QoS qos = qos(); if(qos != QoS.AT_MOST_ONCE) { messageId = is.readShort(); } payload = is.readBuffer(is.available()); if( payload == null ) { payload = new Buffer(0); } return this; }
public UNSUBSCRIBE decode(MQTTFrame frame) throws ProtocolException { assert(frame.buffers.length == 1); header(frame.header()); DataByteArrayInputStream is = new DataByteArrayInputStream(frame.buffers[0]); messageId = is.readShort(); ArrayList<UTF8Buffer> list = new ArrayList<UTF8Buffer>(); while(is.available() > 0) { list.add(MessageSupport.readUTF(is)); } topics = list.toArray(new UTF8Buffer[list.size()]); return this; }
DataByteArrayInputStream is = new DataByteArrayInputStream(frame.buffers[0]); UTF8Buffer protocolName = MessageSupport.readUTF(is); if (V4_PROTOCOL_NAME.equals(protocolName)) { version = is.readByte() & 0xFF; clientId = MessageSupport.readUTF(is); if( clientId.length == 0 ) { clientId = null; willTopic = MessageSupport.readUTF(is); willMessage = MessageSupport.readUTF(is); userName = MessageSupport.readUTF(is); password = MessageSupport.readUTF(is);
public SUBSCRIBE decode(MQTTFrame frame) throws ProtocolException { assert(frame.buffers.length == 1); header(frame.header()); DataByteArrayInputStream is = new DataByteArrayInputStream(frame.buffers[0]); QoS qos = qos(); if(qos != QoS.AT_MOST_ONCE) { messageId = is.readShort(); } ArrayList<Topic> list = new ArrayList<Topic>(); while(is.available() > 0) { Topic topic = new Topic(MessageSupport.readUTF(is), QoS.values()[is.readByte()]); list.add(topic); } topics = list.toArray(new Topic[list.size()]); return this; }
public PUBLISH decode(MQTTFrame frame) throws ProtocolException { assert(frame.buffers.length == 1); header(frame.header()); DataByteArrayInputStream is = new DataByteArrayInputStream(frame.buffers[0]); topicName = MessageSupport.readUTF(is); QoS qos = qos(); if(qos != QoS.AT_MOST_ONCE) { messageId = is.readShort(); } payload = is.readBuffer(is.available()); if( payload == null ) { payload = new Buffer(0); } return this; }