static protected void writeUTF(DataByteArrayOutputStream os, Buffer buffer) throws IOException { os.writeShort(buffer.length); os.write(buffer); }
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(); 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"); } }
os.writeShort(keepAlive); MessageSupport.writeUTF(os, clientId); if(willTopic!=null && willMessage!=null) {
public static void marshalShort(DataByteArrayOutputStream out, short value) throws IOException { out.writeByte(SHORT_TYPE); out.writeShort(value); }
protected void looseMarshalObjectArray(OpenWireFormat wireFormat, DataStructure[] objects, DataByteArrayOutputStream dataOut) throws IOException { dataOut.writeBoolean(objects != null); if (objects != null) { dataOut.writeShort(objects.length); for (int i = 0; i < objects.length; i++) { looseMarshalNestedObject(wireFormat, objects[i], dataOut); } } }
protected void looseMarshalString(UTF8Buffer value, DataByteArrayOutputStream dataOut) throws IOException { dataOut.writeBoolean(value != null); if (value != null) { dataOut.writeShort(value.length); dataOut.write(value); } }
protected void looseMarshalObjectArray(OpenWireFormat wireFormat, DataStructure[] objects, DataByteArrayOutputStream dataOut) throws IOException { dataOut.writeBoolean(objects != null); if (objects != null) { dataOut.writeShort(objects.length); for (int i = 0; i < objects.length; i++) { looseMarshalNestedObject(wireFormat, objects[i], dataOut); } } }
protected void tightMarshalObjectArray2(OpenWireFormat wireFormat, DataStructure[] objects, DataByteArrayOutputStream dataOut, BooleanStream bs) throws IOException { if (bs.readBoolean()) { dataOut.writeShort(objects.length); for (int i = 0; i < objects.length; i++) { tightMarshalNestedObject2(wireFormat, objects[i], dataOut, bs); } } }
protected void looseMarshalString(UTF8Buffer value, DataByteArrayOutputStream dataOut) throws IOException { dataOut.writeBoolean(value != null); if (value != null) { dataOut.writeShort(value.length); dataOut.write(value); } }
protected void tightMarshalString2(UTF8Buffer value, DataByteArrayOutputStream dataOut, BooleanStream bs) throws IOException { if (bs.readBoolean()) { // If we verified it only holds ascii values bs.readBoolean(); dataOut.writeShort(value.length); dataOut.write(value); } }
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"); } }
private void writePageFileHeader(int freePageExtent) throws IOException { DataByteArrayOutputStream os = new DataByteArrayOutputStream(); os.write(HAWT_DB_PAGE_FILE_MAGIC); os.writeInt(freePageExtent); os.writeInt(headerSize); os.writeShort(pageSize); os.close(); mappedFileFactory.getMemoryMappedFile().write(0, os.toBuffer()); }
private void writePageFileHeader(int freePageExtent) throws IOException { DataByteArrayOutputStream os = new DataByteArrayOutputStream(); os.write(HAWT_DB_PAGE_FILE_MAGIC); os.writeInt(freePageExtent); os.writeInt(headerSize); os.writeShort(pageSize); os.close(); mappedFileFactory.getMemoryMappedFile().write(0, os.toBuffer()); }