os.write(':'); os.write(body); message = os.toBuffer();
private void storeContent() { if (dataOut != null) { try { dataOut.close(); setContent(bytesOut.toBuffer()); bytesOut = null; dataOut = null; } catch (IOException ioe) { throw new RuntimeException(ioe); } } }
private void storeContent() { if (dataOut != null) { try { dataOut.close(); setContent(bytesOut.toBuffer()); bytesOut = null; dataOut = null; } catch (IOException ioe) { throw new RuntimeException(ioe); } } }
public byte[] toByteArray() { return toBuffer().toByteArray(); }
public byte[] toByteArray() { return toBuffer().toByteArray(); }
public byte[] toByteArray() { return toBuffer().toByteArray(); }
public void beforeMarshall(OpenWireFormat wireFormat) throws IOException { // Need to marshal the properties. if (marshalledProperties == null && properties != null) { ByteArrayOutputStream baos = new ByteArrayOutputStream(); DataOutputStream os = new DataOutputStream(baos); MarshallingSupport.marshalPrimitiveMap(properties, os); os.close(); marshalledProperties = baos.toBuffer(); } }
public void beforeMarshall(OpenWireFormat wireFormat) throws IOException { // Need to marshal the properties. if (marshalledProperties == null && properties != null) { ByteArrayOutputStream baos = new ByteArrayOutputStream(); DataOutputStream os = new DataOutputStream(baos); MarshallingSupport.marshalPrimitiveMap(properties, os); os.close(); marshalledProperties = baos.toBuffer(); } }
public void beforeMarshall(OpenWireFormat wireFormat) throws IOException { // Need to marshal the properties. if (marshalledProperties == null && properties != null) { ByteArrayOutputStream baos = new ByteArrayOutputStream(); DataOutputStream os = new DataOutputStream(baos); MarshallingSupport.marshalPrimitiveMap(properties, os); os.close(); marshalledProperties = baos.toBuffer(); } }
public void beforeMarshall(OpenWireFormat wireFormat) throws IOException { // Need to marshal the properties. if (marshalledProperties == null && properties != null) { ByteArrayOutputStream baos = new ByteArrayOutputStream(); DataOutputStream os = new DataOutputStream(baos); MarshallingSupport.marshalPrimitiveMap(properties, os); os.close(); marshalledProperties = baos.toBuffer(); } }
private void storeContent() { try { if (dataOut != null) { dataOut.close(); Buffer bs = bytesOut.toBuffer(); if (compressed) { int pos = bs.offset; bs.offset = 0; BufferEditor e = BufferEditor.big(bs); e.writeInt(length); bs.offset = pos; } setContent(bs); bytesOut = null; dataOut = null; } } catch (IOException ioe) { throw new RuntimeException(ioe.getMessage(), ioe); // TODO verify // RuntimeException } }
public void storeContent() { Buffer bodyAsBytes = getContent(); if (bodyAsBytes == null && object != null) { try { ByteArrayOutputStream bytesOut = new ByteArrayOutputStream(); OutputStream os = bytesOut; if (Settings.enable_compression()) { compressed = true; os = new DeflaterOutputStream(os); } DataOutputStream dataOut = new DataOutputStream(os); ObjectOutputStream objOut = new ObjectOutputStream(dataOut); objOut.writeObject(object); objOut.flush(); objOut.reset(); objOut.close(); setContent(bytesOut.toBuffer()); } catch (IOException ioe) { throw new RuntimeException(ioe.getMessage(), ioe); } } }
public void storeContent() { Buffer bodyAsBytes = getContent(); if (bodyAsBytes == null && object != null) { try { ByteArrayOutputStream bytesOut = new ByteArrayOutputStream(); OutputStream os = bytesOut; if (Settings.enable_compression()) { compressed = true; os = new DeflaterOutputStream(os); } DataOutputStream dataOut = new DataOutputStream(os); ObjectOutputStream objOut = new ObjectOutputStream(dataOut); objOut.writeObject(object); objOut.flush(); objOut.reset(); objOut.close(); setContent(bytesOut.toBuffer()); } catch (IOException ioe) { throw new RuntimeException(ioe.getMessage(), ioe); } } }
private void storeContent() { try { if (getContent() == null && !map.isEmpty()) { ByteArrayOutputStream bytesOut = new ByteArrayOutputStream(); OutputStream os = bytesOut; if (Settings.enable_compression()) { compressed = true; os = new DeflaterOutputStream(os); } DataOutputStream dataOut = new DataOutputStream(os); MarshallingSupport.marshalPrimitiveMap(map, dataOut); dataOut.close(); setContent(bytesOut.toBuffer()); } } catch (IOException e) { throw new RuntimeException(e); } }
private void storeContent() { try { if (getContent() == null && !map.isEmpty()) { ByteArrayOutputStream bytesOut = new ByteArrayOutputStream(); OutputStream os = bytesOut; if (Settings.enable_compression()) { compressed = true; os = new DeflaterOutputStream(os); } DataOutputStream dataOut = new DataOutputStream(os); MarshallingSupport.marshalPrimitiveMap(map, dataOut); dataOut.close(); setContent(bytesOut.toBuffer()); } } catch (IOException e) { throw new RuntimeException(e); } }
public void beforeMarshall(OpenWireFormat wireFormat) throws IOException { super.beforeMarshall(wireFormat); Buffer content = getContent(); if (content == null && text != null) { ByteArrayOutputStream bytesOut = new ByteArrayOutputStream(); OutputStream os = bytesOut; if (Settings.enable_compression()) { compressed = true; os = new DeflaterOutputStream(os); } DataOutputStream dataOut = new DataOutputStream(os); MarshallingSupport.writeUTF8(dataOut, this.text); dataOut.close(); setContent(bytesOut.toBuffer()); } }
public void beforeMarshall(OpenWireFormat wireFormat) throws IOException { super.beforeMarshall(wireFormat); Buffer content = getContent(); if (content == null && text != null) { ByteArrayOutputStream bytesOut = new ByteArrayOutputStream(); OutputStream os = bytesOut; if (Settings.enable_compression()) { compressed = true; os = new DeflaterOutputStream(os); } DataOutputStream dataOut = new DataOutputStream(os); MarshallingSupport.writeUTF8(dataOut, this.text); dataOut.close(); setContent(bytesOut.toBuffer()); } }
@Override protected void processDelivery(Delivery delivery) { if( !delivery.isReadable() ) { System.out.println("it was not readable!"); return; } if( current==null ) { current = new ByteArrayOutputStream(); } int count; byte data[] = new byte[1024*4]; while( (count = receiver.recv(data, 0, data.length)) > 0 ) { current.write(data, 0, count); } // Expecting more deliveries.. if( count == 0 ) { return; } receiver.advance(); Buffer buffer = current.toBuffer(); current = null; onMessage(delivery, buffer); }
private AsciiBuffer getNextMessageId() throws JMSException { AsciiBuffer session = null; if(channel!=null) { session = channel.sessionId(); } else { session = connection.getChannel().sessionId(); } AsciiBuffer id = ascii(Long.toString(nextMessageSwquence++)); ByteArrayOutputStream out = new ByteArrayOutputStream(3+session.length() + 1 + id.length()); out.write('I'); out.write('D'); out.write(':'); out.write(session); out.write('-'); out.write(id); return out.toBuffer().ascii(); }
private AsciiBuffer getNextMessageId() throws JMSException { AsciiBuffer session = null; if(channel!=null) { session = channel.sessionId(); } else { session = connection.getChannel().sessionId(); } AsciiBuffer id = ascii(Long.toString(nextMessageSwquence++)); ByteArrayOutputStream out = new ByteArrayOutputStream(3+session.length() + 1 + id.length()); out.write('I'); out.write('D'); out.write(':'); out.write(session); out.write('-'); out.write(id); return out.toBuffer().ascii(); }