public MQTTFrame apply() throws IOException { int limit = readBuffer.position(); if ((limit - readStart) < length) { readEnd = limit; return null; } else { Buffer body = new Buffer(readBuffer.array(), readStart, length); readEnd = readStart = readStart + length; nextDecodeAction = readHeader; return new MQTTFrame(body).header(header); } } };
public MQTTFrame apply() throws IOException { int length = readLength(); if( length >= 0 ) { if( length > maxMessageLength) { throw new IOException("The maximum message length was exceeded"); } byte header = readBuffer.get(readStart); readStart = readEnd; if( length > 0 ) { nextDecodeAction = readBody(header, length); } else { return new MQTTFrame().header(header); } } return null; } };
public MQTTFrame encode() { return new MQTTFrame().commandType(messageType()); } }
public MQTTFrame encode() { try { DataByteArrayOutputStream os = new DataByteArrayOutputStream(2); os.writeShort(messageId); MQTTFrame frame = new MQTTFrame(); frame.commandType(messageType()); return frame.buffer(os.toBuffer()); } catch (IOException e) { throw new RuntimeException("The impossible happened"); } }
public MQTTFrame encode() { try { DataByteArrayOutputStream os = new DataByteArrayOutputStream(2+grantedQos.length); os.writeShort(messageId); os.write(grantedQos); MQTTFrame frame = new MQTTFrame(); frame.commandType(TYPE); return frame.buffer(os.toBuffer()); } catch (IOException e) { throw new RuntimeException("The impossible happened"); } }
public MQTTFrame encode() { try { DataByteArrayOutputStream os = new DataByteArrayOutputStream(2); os.writeShort(messageId); MQTTFrame frame = new MQTTFrame(); frame.header(header()); frame.commandType(TYPE); return frame.buffer(os.toBuffer()); } catch (IOException e) { throw new RuntimeException("The impossible happened"); } }
public MQTTFrame encode() { try { DataByteArrayOutputStream os = new DataByteArrayOutputStream(2); os.writeByte(0); os.writeByte(code.ordinal()); MQTTFrame frame = new MQTTFrame(); frame.commandType(TYPE); return frame.buffer(os.toBuffer()); } catch (IOException e) { throw new RuntimeException("The impossible happened"); } }
public MQTTFrame encode() { try { DataByteArrayOutputStream os = new DataByteArrayOutputStream(); QoS qos = qos(); if(qos != QoS.AT_MOST_ONCE) { os.writeShort(messageId); } for(UTF8Buffer topic: topics) { MessageSupport.writeUTF(os, topic); } MQTTFrame frame = new MQTTFrame(); frame.header(header()); frame.commandType(TYPE); return frame.buffer(os.toBuffer()); } catch (IOException e) { throw new RuntimeException("The impossible happened"); } }
public MQTTFrame encode() { try { DataByteArrayOutputStream os = new DataByteArrayOutputStream(); MessageSupport.writeUTF(os, topicName); QoS qos = qos(); if(qos != QoS.AT_MOST_ONCE) { os.writeShort(messageId); } MQTTFrame frame = new MQTTFrame(); frame.header(header()); frame.commandType(TYPE); if(payload!=null && payload.length!=0) { os.write(payload); } frame.buffer(os.toBuffer()); return frame; } catch (IOException e) { throw new RuntimeException("The impossible happened"); } }
public MQTTFrame encode() { try { DataByteArrayOutputStream os = new DataByteArrayOutputStream(); QoS qos = qos(); if(qos != QoS.AT_MOST_ONCE) { os.writeShort(messageId); } for(Topic topic: topics) { MessageSupport.writeUTF(os, topic.name()); os.writeByte(topic.qos().ordinal()); } MQTTFrame frame = new MQTTFrame(); frame.header(header()); frame.commandType(TYPE); return frame.buffer(os.toBuffer()); } catch (IOException e) { throw new RuntimeException("The impossible happened"); } }
MQTTFrame frame = new MQTTFrame(); frame.commandType(TYPE); return frame.buffer(os.toBuffer());
private void processCommand() throws IOException { Buffer frameContents = null; if (currentBuffer == scratch) { frameContents = scratch.deepCopy(); } else { frameContents = currentBuffer; currentBuffer = null; } MQTTFrame frame = new MQTTFrame(frameContents).header(header); frameSink.onFrame(frame); }
private void processCommand() throws IOException { Buffer frameContents = null; if (currentBuffer == scratch) { frameContents = scratch.deepCopy(); } else { frameContents = currentBuffer; currentBuffer = null; } MQTTFrame frame = new MQTTFrame(frameContents).header(header); frameSink.onFrame(frame); }
public MQTTFrame apply() throws IOException { Buffer body = readBytes(remaining); if (body == null) { return null; } else { nextDecodeAction = readHeader; // TODO: optimize out this conversion to byte[] return new MQTTFrame(new org.fusesource.hawtbuf.Buffer(body.getBytes())).header(header); } } };
public MQTTFrame apply() throws IOException { Buffer body = readBytes(remaining); if( body==null ) { return null; } else { nextDecodeAction = readHeader; // TODO: optimize out this conversion to byte[] return new MQTTFrame(new org.fusesource.hawtbuf.Buffer(body.getBytes())).header(header); } } };
public MQTTFrame apply() throws IOException { Buffer body = readBytes(remaining); if (body == null) { return null; } else { nextDecodeAction = readHeader; // TODO: optimize out this conversion to byte[] return new MQTTFrame(new org.fusesource.hawtbuf.Buffer(body.getBytes())).header(header); } } };
public MQTTFrame encode() { try { DataByteArrayOutputStream os = new DataByteArrayOutputStream(2+grantedQos.length); os.writeShort(messageId); os.write(grantedQos); MQTTFrame frame = new MQTTFrame(); frame.commandType(TYPE); return frame.buffer(os.toBuffer()); } catch (IOException e) { throw new RuntimeException("The impossible happened"); } }
public MQTTFrame encode() { try { DataByteArrayOutputStream os = new DataByteArrayOutputStream(2); os.writeShort(messageId); MQTTFrame frame = new MQTTFrame(); frame.commandType(messageType()); return frame.buffer(os.toBuffer()); } catch (IOException e) { throw new RuntimeException("The impossible happened"); } }
public MQTTFrame encode() { try { DataByteArrayOutputStream os = new DataByteArrayOutputStream(2); os.writeShort(messageId); MQTTFrame frame = new MQTTFrame(); frame.header(header()); frame.commandType(TYPE); return frame.buffer(os.toBuffer()); } catch (IOException e) { throw new RuntimeException("The impossible happened"); } }
public MQTTFrame encode() { try { DataByteArrayOutputStream os = new DataByteArrayOutputStream(2); os.writeByte(0); os.writeByte(code.ordinal()); MQTTFrame frame = new MQTTFrame(); frame.commandType(TYPE); return frame.buffer(os.toBuffer()); } catch (IOException e) { throw new RuntimeException("The impossible happened"); } }