Package org.fusesource.hawtbuf

Examples of org.fusesource.hawtbuf.Buffer


                looseOut.writeByte(type);
                dsm.looseMarshal(this, c, looseOut);

                if (!sizePrefixDisabled) {
                    Buffer sequence = bytesOut.toBuffer();
                    dataOut.writeInt(sequence.getLength());
                    dataOut.write(sequence.getData(), sequence.getOffset(), sequence.getLength());
                }

            }

        } else {
View Full Code Here


            return 0;
        }

        if (o.isMarshallAware()) {
            // MarshallAware ma = (MarshallAware)o;
            Buffer sequence = null;
            // sequence=ma.getCachedMarshalledForm(this);
            bs.writeBoolean(sequence != null);
            if (sequence != null) {
                return 1 + sequence.getLength();
            }
        }

        byte type = o.getDataStructureType();
        DataStreamMarshaller dsm = (DataStreamMarshaller) dataMarshallers[type & 0xFF];
View Full Code Here

        return DATA_STRUCTURE_TYPE;
    }

    public synchronized String getTransactionKey() {
        if (transactionKey == null) {
            transactionKey = "XID:" + formatId + ":" + HexSupport.toHexFromBuffer(new Buffer(globalTransactionId)) + ":"
                             + HexSupport.toHexFromBuffer(new Buffer(branchQualifier));
        }
        return transactionKey;
    }
View Full Code Here

    }

    private void initializeReading() throws OpenwireException {
        checkWriteOnlyBody();
        if (this.dataIn == null) {
            Buffer data = getContent();
            if (data == null) {
                data = new Buffer(new byte[] {}, 0, 0);
            }
            InputStream is = new ByteArrayInputStream(data);
            if (isCompressed()) {
                is = new InflaterInputStream(is);
                is = new BufferedInputStream(is);
View Full Code Here

        super.copy(copy);
        copy.object = null;
    }

    public void storeContent() {
        Buffer bodyAsBytes = getContent();
        if (bodyAsBytes == null && object != null) {
            try {
                ByteArrayOutputStream bytesOut = new ByteArrayOutputStream();
                OutputStream os = bytesOut;
                if (Settings.enable_compression()) {
View Full Code Here

     * @throws OpenwireException
     */
    public Serializable getObject() throws OpenwireException {
        if (object == null && getContent() != null) {
            try {
                Buffer content = getContent();
                InputStream is = new ByteArrayInputStream(content);
                if (isCompressed()) {
                    is = new InflaterInputStream(is);
                }
                DataInputStream dataIn = new DataInputStream(is);
View Full Code Here

        String stringBody = m.getBodyAs(String.class);
        if (stringBody!=null) {
            return evaluate(stringBody);
        }
       
        Buffer bufferBody = m.getBodyAs(Buffer.class);
        if (bufferBody!=null) {
            return evaluate(bufferBody);
        }
        return false;
    }
View Full Code Here

    public String getText() throws OpenwireException {
        if (text == null && getContent() != null) {
            InputStream is = null;
            try {
                Buffer bodyAsBytes = getContent();
                if (bodyAsBytes != null) {
                    is = new ByteArrayInputStream(bodyAsBytes);
                    if (isCompressed()) {
                        is = new InflaterInputStream(is);
                    }
View Full Code Here

    }

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

                    if( type == Buffer.class ) {
                        if ( Message.this instanceof ActiveMQBytesMessage ) {
                            ActiveMQBytesMessage bm = ((ActiveMQBytesMessage)Message.this);
                            byte data[] = new byte[(int) bm.getBodyLength()];
                            bm.readBytes(data);
                            return type.cast(new Buffer(data));
                        }
                    }
                    return null;
                } catch (OpenwireException e) {
                    throw new FilterException(e);
View Full Code Here

TOP

Related Classes of org.fusesource.hawtbuf.Buffer

Copyright © 2018 www.massapicom. 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.