Search in sources :

Example 31 with MessageEOFException

use of javax.jms.MessageEOFException in project rocketmq-externals by apache.

the class JmsBytesMessage method handleInputException.

private JMSException handleInputException(final IOException e) {
    JMSException ex;
    if (e instanceof EOFException) {
        ex = new MessageEOFException(e.getMessage());
    } else {
        ex = new MessageFormatException(e.getMessage());
    }
    ex.initCause(e);
    ex.setLinkedException(e);
    return ex;
}
Also used : MessageFormatException(javax.jms.MessageFormatException) MessageEOFException(javax.jms.MessageEOFException) MessageEOFException(javax.jms.MessageEOFException) EOFException(java.io.EOFException) JMSException(javax.jms.JMSException)

Example 32 with MessageEOFException

use of javax.jms.MessageEOFException in project rabbitmq-jms-client by rabbitmq.

the class RMQBytesMessage method readLong.

/**
 * {@inheritDoc}
 */
@Override
public long readLong() throws JMSException {
    if (!this.reading)
        throw new MessageNotReadableException(NOT_READABLE);
    if (this.pos + Bits.NUM_BYTES_IN_LONG > this.buf.length)
        throw new MessageEOFException(MSG_EOF);
    long l = Bits.getLong(this.buf, this.pos);
    this.pos += Bits.NUM_BYTES_IN_LONG;
    return l;
}
Also used : MessageEOFException(javax.jms.MessageEOFException) MessageNotReadableException(javax.jms.MessageNotReadableException)

Example 33 with MessageEOFException

use of javax.jms.MessageEOFException in project rabbitmq-jms-client by rabbitmq.

the class RMQBytesMessage method readInt.

/**
 * {@inheritDoc}
 */
@Override
public int readInt() throws JMSException {
    if (!this.reading)
        throw new MessageNotReadableException(NOT_READABLE);
    if (this.pos + Bits.NUM_BYTES_IN_INT > this.buf.length)
        throw new MessageEOFException(MSG_EOF);
    int i = Bits.getInt(this.buf, this.pos);
    this.pos += Bits.NUM_BYTES_IN_INT;
    return i;
}
Also used : MessageEOFException(javax.jms.MessageEOFException) MessageNotReadableException(javax.jms.MessageNotReadableException)

Example 34 with MessageEOFException

use of javax.jms.MessageEOFException in project rabbitmq-jms-client by rabbitmq.

the class RMQBytesMessage method readShort.

/**
 * {@inheritDoc}
 */
@Override
public short readShort() throws JMSException {
    if (!this.reading)
        throw new MessageNotReadableException(NOT_READABLE);
    if (this.pos + Bits.NUM_BYTES_IN_SHORT > this.buf.length)
        throw new MessageEOFException(MSG_EOF);
    short s = Bits.getShort(this.buf, this.pos);
    this.pos += Bits.NUM_BYTES_IN_SHORT;
    return s;
}
Also used : MessageEOFException(javax.jms.MessageEOFException) MessageNotReadableException(javax.jms.MessageNotReadableException)

Example 35 with MessageEOFException

use of javax.jms.MessageEOFException in project rabbitmq-jms-client by rabbitmq.

the class RMQBytesMessage method readUnsignedShort.

/**
 * {@inheritDoc}
 */
@Override
public int readUnsignedShort() throws JMSException {
    if (!this.reading)
        throw new MessageNotReadableException(NOT_READABLE);
    if (this.pos + Bits.NUM_BYTES_IN_SHORT > this.buf.length)
        throw new MessageEOFException(MSG_EOF);
    short s = Bits.getShort(this.buf, this.pos);
    this.pos += Bits.NUM_BYTES_IN_SHORT;
    return ((int) s) & 0xFFFF;
}
Also used : MessageEOFException(javax.jms.MessageEOFException) MessageNotReadableException(javax.jms.MessageNotReadableException)

Aggregations

MessageEOFException (javax.jms.MessageEOFException)35 MessageNotReadableException (javax.jms.MessageNotReadableException)21 MessageFormatException (javax.jms.MessageFormatException)16 MessageConsumer (javax.jms.MessageConsumer)7 MessageProducer (javax.jms.MessageProducer)7 Session (javax.jms.Session)6 StreamMessage (javax.jms.StreamMessage)6 Test (org.junit.Test)6 BytesMessage (javax.jms.BytesMessage)5 JMSException (javax.jms.JMSException)4 MessageNotWriteableException (javax.jms.MessageNotWriteableException)4 ArrayList (java.util.ArrayList)3 RMQJMSException (com.rabbitmq.jms.util.RMQJMSException)2 EOFException (java.io.EOFException)2 HashMap (java.util.HashMap)2 Connection (javax.jms.Connection)2 MapMessage (javax.jms.MapMessage)2 Message (javax.jms.Message)2 Queue (javax.jms.Queue)2 StreamMessageUtil.streamReadInteger (org.apache.activemq.artemis.reader.StreamMessageUtil.streamReadInteger)2