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"); } }
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"); } }
return frame.buffer(os.toBuffer()); } catch (IOException e) { throw new RuntimeException("The impossible happened");
public static Buffer writeBufferFromObject(Object object) throws JMSException { try { DataByteArrayOutputStream buffer = new DataByteArrayOutputStream(); ObjectOutputStream out = new ObjectOutputStream(buffer); out.writeObject(object); out.close(); return buffer.toBuffer(); } catch (IOException e) { throw new JMSException("Could not encode: "+e); } }
protected void flushNextWriteBuffer() { DataByteArrayOutputStream next = allocateNextWriteBuffer(); ByteBuffer bb = nextWriteBuffer.toBuffer().toByteBuffer(); writeBuffer.add(bb); writeBufferRemaining += bb.remaining(); nextWriteBuffer = next; }
public Buffer toBuffer(boolean includeBody) { try { DataByteArrayOutputStream out = new DataByteArrayOutputStream(); write(out, includeBody); return out.toBuffer(); } catch (IOException e) { throw new RuntimeException(e); // not expected to occur. } }
public void storeContent() throws JMSException { try { if (bytesOut != null) { bytesOut.close(); Buffer bs = bytesOut.toBuffer(); setContent(bs); bytesOut = null; } } catch (IOException ioe) { throw StompJmsExceptionSupport.create(ioe); } }
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"); } }
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 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; }