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.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(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"); } }
throw new IllegalArgumentException("A clean session must be used when no clientId is specified"); DataByteArrayOutputStream os = new DataByteArrayOutputStream(500); if(version==3) { MessageSupport.writeUTF(os, V3_PROTOCOL_NAME);
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"); } }
private void initializeWriting() throws JMSException { checkReadOnlyBody(); if (this.bytesOut == null) { this.bytesOut = new DataByteArrayOutputStream(); } }
public Buffer marshallKey(String key) throws IOException { DataByteArrayOutputStream baos = new DataByteArrayOutputStream(); keyCodec.encode(key, baos); return baos.toBuffer(); }
public static String propertiesToString(Properties props) throws IOException { String result = ""; if (props != null) { DataByteArrayOutputStream dataOut = new DataByteArrayOutputStream(); props.store(dataOut, ""); result = new String(dataOut.getData(), 0, dataOut.size()); dataOut.close(); } return result; }
public int hashKey(K value) { try { DataByteArrayOutputStream os = new DataByteArrayOutputStream(); keyCodec.encode(value, os); return hash(os.toBuffer()); } catch (IOException e) { throw new RuntimeException(e); } }
public int hashNode(N node, int i) { try { DataByteArrayOutputStream os = new DataByteArrayOutputStream(); nodeCodec.encode(node, os); os.write(':'); os.writeInt(i); return hash(os.toBuffer()); } catch (IOException e) { throw new RuntimeException(e); } }
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"); } }
private MessagePB.Bean createMessagePB(Message message, long messageKey) throws IOException { DataByteArrayOutputStream mos = new DataByteArrayOutputStream(); mos.writeBoolean(TIGHT_ENCODING); mos.writeVarInt(OPENWIRE_VERSION); wireformat.marshal(message, mos); MessagePB.Bean messageRecord = new MessagePB.Bean(); messageRecord.setCodec(codec_id); messageRecord.setMessageKey(messageKey); messageRecord.setSize(message.getSize()); messageRecord.setValue(mos.toBuffer()); return messageRecord; }
private MessagePB.Bean createMessagePB(Message message, long messageKey) throws IOException { DataByteArrayOutputStream mos = new DataByteArrayOutputStream(); mos.writeBoolean(TIGHT_ENCODING); mos.writeVarInt(OPENWIRE_VERSION); wireformat.marshal(message, mos); MessagePB.Bean messageRecord = new MessagePB.Bean(); messageRecord.setCodec(codec_id); messageRecord.setMessageKey(messageKey); messageRecord.setSize(message.getSize()); messageRecord.setValue(mos.toBuffer()); return messageRecord; }
private MessagePB.Bean createMessagePB(Message message, long messageKey) throws IOException { DataByteArrayOutputStream mos = new DataByteArrayOutputStream(); mos.writeBoolean(TIGHT_ENCODING); mos.writeVarInt(OPENWIRE_VERSION); wireformat.marshal(message, mos); MessagePB.Bean messageRecord = new MessagePB.Bean(); messageRecord.setCodec(codec_id); messageRecord.setMessageKey(messageKey); messageRecord.setSize(message.getSize()); messageRecord.setValue(mos.toBuffer()); return messageRecord; }