Package org.activemq.io.util

Examples of org.activemq.io.util.ByteArray


     * @param data The bodyAsBytes to set.
     * @param offset
     * @param length
     */
    public void setBodyAsBytes(byte[] data,int offset, int length) {
        this.bodyAsBytes = new ByteArray(data);
    }
View Full Code Here


    protected void writeTextMessage(ActiveMQTextMessage message, DataOutput out) throws JMSException, IOException {
        writeMessage(message, message.getText(), out);
    }

    protected void writeBytesMessage(ActiveMQBytesMessage message, DataOutput out) throws IOException {
        ByteArray data = message.getBodyAsBytes();
        String text = encodeBinary(data.getBuf(), data.getOffset(), data.getLength());
        writeMessage(message, text, out);
    }
View Full Code Here

                            bas[i] = array[i].getBodyAsBytes();
                            if (i >= 1){
                                array[i].clearBody();
                            }
                        }
                        ByteArray ba = fragmentation.assemble(bas);
                        result.setBodyAsBytes(ba);
                    }
                    catch (IOException ioe) {
                        JMSException jmsEx = new JMSException("Failed to assemble fragment message: " + parentId);
                        jmsEx.setLinkedException(ioe);
View Full Code Here

                    }
                    else {
                        msg = (ActiveMQMessage) consumer.receiveNoWait();
                    }
                    if (msg != null) {
                        ByteArray ba = msg.getBodyAsBytes();
                        if (ba != null) {
                            len += ba.getLength();
                            process(ba);
                        }
                    }
                    else if (closed) {
                        break;
View Full Code Here

    public ActiveMQMessage deepCopy() throws JMSException {
        ActiveMQBytesMessage other = new ActiveMQBytesMessage();
        this.initializeOther(other);
        try {
            if (this.getBodyAsBytes() != null) {
                ByteArray data = this.getBodyAsBytes().copy();
                other.setBodyAsBytes(data);
            }
        }
        catch (IOException e) {
            JMSException jmsEx = new JMSException("setBodyAsBytes() failed");
View Full Code Here

    private void initializeReading() throws MessageNotReadableException {
        if (!super.readOnlyMessage) {
            throw new MessageNotReadableException("This message is in write-only mode");
        }
        try {
            ByteArray data = super.getBodyAsBytes();
            if (this.dataIn == null && data != null) {
                if (ByteArrayCompression.isCompressed(data)){
                    ByteArrayCompression compression = new ByteArrayCompression();
                    data = compression.inflate(data);
                }
                this.bodyLength = data.getLength();
                ByteArrayInputStream bytesIn = new ByteArrayInputStream(data.getBuf(),data.getOffset(),data.getLength());
                this.dataIn = new DataInputStream(bytesIn);
            }
        }
        catch (IOException e) {
            MessageNotReadableException mnr = new MessageNotReadableException("getBodyAsBytes failed");
View Full Code Here

                            bas[i] = array[i].getBodyAsBytes();
                            if (i >= 1){
                                array[i].clearBody();
                            }
                        }
                        ByteArray ba = fragmentation.assemble(bas);
                        result.setBodyAsBytes(ba);
                    }
                    catch (IOException ioe) {
                        JMSException jmsEx = new JMSException("Failed to assemble fragment message: " + parentId);
                        jmsEx.setLinkedException(ioe);
View Full Code Here

    protected void writeTextMessage(ActiveMQTextMessage message, DataOutput out) throws JMSException, IOException {
        writeMessage(message, message.getText(), out);
    }

    protected void writeBytesMessage(ActiveMQBytesMessage message, DataOutput out) throws IOException {
        ByteArray data = message.getBodyAsBytes();
        String text = encodeBinary(data.getBuf(), data.getOffset(), data.getLength());
        writeMessage(message, text, out);
    }
View Full Code Here

        if (bodyAsBytes == null) {
            ByteArrayOutputStream bytesOut = new ByteArrayOutputStream();
            DataOutputStream dataOut = new DataOutputStream(bytesOut);
            writeBody(dataOut);
            dataOut.flush();
            bodyAsBytes = new ByteArray(bytesOut.toByteArray());
            dataOut.close();
        }
    }
View Full Code Here

     * @param data The bodyAsBytes to set.
     * @param offset
     * @param length
     */
    public void setBodyAsBytes(byte[] data,int offset, int length) {
        this.bodyAsBytes = new ByteArray(data);
    }
View Full Code Here

TOP

Related Classes of org.activemq.io.util.ByteArray

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.