Examples of toBuffer()


Examples of org.fusesource.hawtbuf.ByteArrayOutputStream.toBuffer()

        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 afterMarshall(OpenWireFormat wireFormat) throws IOException {
    }
View Full Code Here

Examples of org.fusesource.hawtbuf.ByteArrayOutputStream.toBuffer()

                os = new DeflaterOutputStream(os);
            }
            DataOutputStream dataOut = new DataOutputStream(os);
            MarshallingSupport.writeUTF8(dataOut, this.text);
            dataOut.close();
            setContent(bytesOut.toBuffer());
            //see https://issues.apache.org/activemq/browse/AMQ-2103
            this.text=null;
        }
    }
View Full Code Here

Examples of org.fusesource.hawtbuf.ByteArrayOutputStream.toBuffer()

        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 afterMarshall(OpenWireFormat wireFormat) throws IOException {
    }
View Full Code Here

Examples of org.fusesource.hawtbuf.ByteArrayOutputStream.toBuffer()

    }

    static public Buffer encode(Object value) throws IOException {
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        mapper.writeValue(baos, value);
        return baos.toBuffer();
    }

}
View Full Code Here

Examples of org.fusesource.hawtbuf.ByteArrayOutputStream.toBuffer()

                    long id = sent + 1;
                    ByteArrayOutputStream os = new ByteArrayOutputStream(message.length + 15);
                    os.write(new AsciiBuffer(Long.toString(id)));
                    os.write(':');
                    os.write(body);
                    message = os.toBuffer();
                }
                connection.publish(topic, message, qos, retain, new Callback<Void>() {
                    public void onSuccess(Void value) {
                        sent ++;
                        if(debug) {
View Full Code Here

Examples of org.fusesource.hawtbuf.DataByteArrayOutputStream.toBuffer()

            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);
            }
        }
View Full Code Here

Examples of org.fusesource.hawtbuf.DataByteArrayOutputStream.toBuffer()

        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);
            }
        }
View Full Code Here

Examples of org.fusesource.hawtbuf.DataByteArrayOutputStream.toBuffer()

    private Codec<DefaultExchangeHolder> exchangeCodec = new ObjectCodec<DefaultExchangeHolder>();

    public Buffer marshallKey(String key) throws IOException {
        DataByteArrayOutputStream baos = new DataByteArrayOutputStream();
        keyCodec.encode(key, baos);
        return baos.toBuffer();
    }

    public String unmarshallKey(Buffer buffer) throws IOException {
        DataByteArrayInputStream bais = new DataByteArrayInputStream(buffer);
        String key = keyCodec.decode(bais);
View Full Code Here

Examples of org.fusesource.hawtbuf.DataByteArrayOutputStream.toBuffer()

        // persist the from endpoint as well
        if (exchange.getFromEndpoint() != null) {
            DefaultExchangeHolder.addProperty(pe, "CamelAggregatedFromEndpoint", exchange.getFromEndpoint().getEndpointUri());
        }
        exchangeCodec.encode(pe, baos);
        return baos.toBuffer();
    }

    public Exchange unmarshallExchange(CamelContext camelContext, Buffer buffer) throws IOException {
        DataByteArrayInputStream bais = new DataByteArrayInputStream(buffer);
        DefaultExchangeHolder pe = exchangeCodec.decode(bais);
View Full Code Here

Examples of org.fusesource.hawtbuf.DataByteArrayOutputStream.toBuffer()

    private Codec<DefaultExchangeHolder> exchangeCodec = new ObjectCodec<DefaultExchangeHolder>();

    public Buffer marshallKey(String key) throws IOException {
        DataByteArrayOutputStream baos = new DataByteArrayOutputStream();
        keyCodec.encode(key, baos);
        return baos.toBuffer();
    }

    public String unmarshallKey(Buffer buffer) throws IOException {
        DataByteArrayInputStream bais = new DataByteArrayInputStream(buffer);
        String key = keyCodec.decode(bais);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.