public static void bytesMessageReset(ActiveMQBuffer message) { message.resetReaderIndex(); }
/** * Utility method to set the Text message on a message body */ public static SimpleString readBodyText(ActiveMQBuffer buff) { buff.resetReaderIndex(); return buff.readNullableSimpleString(); }
@Override public void reset() throws JMSException { if (!readOnly) { readOnly = true; } getBuffer().resetReaderIndex(); }
public void doBeforeSend() throws Exception { message.getBodyBuffer().resetReaderIndex(); }
public void doBeforeReceive() throws ActiveMQException { message.checkCompletion(); ActiveMQBuffer body = message.getBodyBuffer(); if (body != null) { body.resetReaderIndex(); } }
/** * Utility method to set the map on a message body */ public static void readBodyMap(ActiveMQBuffer message, TypedProperties map) { message.resetReaderIndex(); map.decode(message.byteBuf()); }
private ActiveMQBuffer inflate(ActiveMQBuffer buffer) throws DataFormatException { int bytesToRead = buffer.readableBytes(); Inflater inflater = new Inflater(); inflater.setInput(ByteUtil.getActiveArray(buffer.readBytes(bytesToRead).toByteBuffer())); //get the real size of large message long sizeBody = getLongProperty(Message.HDR_LARGE_BODY_SIZE); byte[] data = new byte[(int) sizeBody]; inflater.inflate(data); inflater.end(); ActiveMQBuffer qbuff = ActiveMQBuffers.wrappedBuffer(data); qbuff.resetReaderIndex(); qbuff.resetWriterIndex(); qbuff.writeBytes(data); buffer = qbuff; return buffer; }
msgI.getBodyBuffer().resetReaderIndex(); msgI.getBodyBuffer().resetWriterIndex(); msgI.putLongProperty(Message.HDR_LARGE_BODY_SIZE, deflaterReader.getTotalSize());
/** * Utility method to set the Text message on a message body */ public static SimpleString readBodyText(ActiveMQBuffer buff) { buff.resetReaderIndex(); return buff.readNullableSimpleString(); }
/** * Utility method to set the Text message on a message body */ public static SimpleString readBodyText(ActiveMQBuffer buff) { buff.resetReaderIndex(); return buff.readNullableSimpleString(); }
public void doBeforeSend() throws Exception { message.getBodyBuffer().resetReaderIndex(); }
public void doBeforeReceive() throws ActiveMQException { message.checkCompletion(); ActiveMQBuffer body = message.getBodyBuffer(); if (body != null) { body.resetReaderIndex(); } }
/** * Utility method to set the map on a message body */ public static void readBodyMap(ActiveMQBuffer message, TypedProperties map) { message.resetReaderIndex(); map.decode(message.byteBuf()); }
/** * Utility method to set the map on a message body */ public static void readBodyMap(ActiveMQBuffer message, TypedProperties map) { message.resetReaderIndex(); map.decode(message.byteBuf()); }
/** * Utility method to set the map on a message body */ public static void readBodyMap(ActiveMQBuffer message, TypedProperties map) { message.resetReaderIndex(); map.decode(message.byteBuf()); }
public void decode() throws Exception { if (!message.isLargeMessage()) { message.getBodyBuffer().resetReaderIndex(); } }
/** * Encode the body into the internal message */ public void encode() throws Exception { if (!message.isLargeMessage()) { message.getBodyBuffer().resetReaderIndex(); } }
public static void assertEqualsBuffers(final int size, final ActiveMQBuffer expected, final ActiveMQBuffer actual) { // assertEquals(expected.length, actual.length); expected.readerIndex(0); actual.readerIndex(0); for (int i = 0; i < size; i++) { byte b1 = expected.readByte(); byte b2 = actual.readByte(); Assert.assertEquals("byte at index " + i, b1, b2); } expected.resetReaderIndex(); actual.resetReaderIndex(); }
@Test public void testRewind() throws Exception { int i = RandomUtil.randomInt(); wrapper.writeInt(i); Assert.assertEquals(i, wrapper.readInt()); wrapper.resetReaderIndex(); Assert.assertEquals(i, wrapper.readInt()); }
private CoreMessage createMessage(final long id, final PagingStore store, final SimpleString destination, final ActiveMQBuffer buffer) { CoreMessage msg = new CoreMessage(id, 50 + buffer.capacity()); msg.setAddress(destination); msg.setContext(store); msg.getBodyBuffer().resetReaderIndex(); msg.getBodyBuffer().resetWriterIndex(); msg.getBodyBuffer().writeBytes(buffer, buffer.capacity()); return msg; }