Class ResetLimitWrappedActiveMQBuffer
java.lang.Object
org.apache.activemq.artemis.core.buffers.impl.ChannelBufferWrapper
org.apache.activemq.artemis.core.buffers.impl.ResetLimitWrappedActiveMQBuffer
- All Implemented Interfaces:
DataInput,ActiveMQBuffer
A ResetLimitWrappedActiveMQBuffer
-
Field Summary
Fields inherited from class org.apache.activemq.artemis.core.buffers.impl.ChannelBufferWrapper
buffer -
Constructor Summary
ConstructorsConstructorDescriptionResetLimitWrappedActiveMQBuffer(int limit, io.netty.buffer.ByteBuf buffer, Message message) ResetLimitWrappedActiveMQBuffer(int limit, ActiveMQBuffer buffer, Message message) -
Method Summary
Modifier and TypeMethodDescriptionvoidclear()Sets thereaderIndexandwriterIndexof this buffer to0.voidreaderIndex(int readerIndex) Sets thereaderIndexof this buffer.voidRepositions the currentreaderIndexto the markedreaderIndexin this buffer.voidRepositions the currentwriterIndexto the markedwriterIndexin this buffer.voidsetByte(int index, byte value) Sets the specified byte at the specified absoluteindexin this buffer.voidsetBytes(int index, byte[] src) Transfers the specified source array's data to this buffer starting at the specified absoluteindex.voidsetBytes(int index, byte[] src, int srcIndex, int length) Transfers the specified source array's data to this buffer starting at the specified absoluteindex.voidsetBytes(int index, ByteBuffer src) Transfers the specified source buffer's data to this buffer starting at the specified absoluteindexuntil the source buffer's position reaches its limit.voidsetBytes(int index, ActiveMQBuffer src) Transfers the specified source buffer's data to this buffer starting at the specified absoluteindexuntil the destination becomes unreadable.voidsetBytes(int index, ActiveMQBuffer src, int length) Transfers the specified source buffer's data to this buffer starting at the specified absoluteindex.voidsetBytes(int index, ActiveMQBuffer src, int srcIndex, int length) Transfers the specified source buffer's data to this buffer starting at the specified absoluteindex.voidsetChar(int index, char value) Sets the specified char at the specified absoluteindexin this buffer.voidsetDouble(int index, double value) Sets the specified double at the specified absoluteindexin this buffer.voidsetFloat(int index, float value) Sets the specified float at the specified absoluteindexin this buffer.voidsetIndex(int readerIndex, int writerIndex) Sets thereaderIndexandwriterIndexof this buffer in one shot.voidsetInt(int index, int value) Sets the specified 32-bit integer at the specified absoluteindexin this buffer.voidsetLong(int index, long value) Sets the specified 64-bit long integer at the specified absoluteindexin this buffer.voidsetMessage(Message message) We need to turn of notifications of body changes on reset on the server side when dealing with AMQP conversions, for that reason this method will set the message to null herevoidsetShort(int index, short value) Sets the specified 16-bit short integer at the specified absoluteindexin this buffer.voidwriteBoolean(boolean val) Sets the specified boolean at the currentwriterIndexvoidwriteByte(byte value) Sets the specified byte at the currentwriterIndexand increases thewriterIndexby1in this buffer.voidwriteBytes(byte[] src) Transfers the specified source array's data to this buffer starting at the currentwriterIndexand increases thewriterIndexby the number of the transferred bytes (=src.length).voidwriteBytes(byte[] src, int srcIndex, int length) Transfers the specified source array's data to this buffer starting at the currentwriterIndexand increases thewriterIndexby the number of the transferred bytes (=length).voidwriteBytes(io.netty.buffer.ByteBuf src, int srcIndex, int length) Transfers the specified source buffer's data to this buffer starting at the currentwriterIndexuntil the source buffer's position reaches its limit, and increases thewriterIndexby the number of the transferred bytes.voidwriteBytes(ByteBuffer src) Transfers the specified source buffer's data to this buffer starting at the currentwriterIndexuntil the source buffer's position reaches its limit, and increases thewriterIndexby the number of the transferred bytes.voidwriteBytes(ActiveMQBuffer src, int length) Transfers the specified source buffer's data to this buffer starting at the currentwriterIndexand increases thewriterIndexby the number of the transferred bytes (=length).voidwriteBytes(ActiveMQBuffer src, int srcIndex, int length) Transfers the specified source buffer's data to this buffer starting at the currentwriterIndexand increases thewriterIndexby the number of the transferred bytes (=length).voidwriteChar(char chr) Sets the specified char at the currentwriterIndexand increases thewriterIndexby2in this buffer.voidwriteDouble(double value) Sets the specified double at the currentwriterIndexand increases thewriterIndexby8in this buffer.voidwriteFloat(float value) Sets the specified float at the currentwriterIndexand increases thewriterIndexby4in this buffer.voidwriteInt(int value) Sets the specified 32-bit integer at the currentwriterIndexand increases thewriterIndexby4in this buffer.voidwriteLong(long value) Sets the specified 64-bit long integer at the currentwriterIndexand increases thewriterIndexby8in this buffer.voidSets the specified (potentiallynull) Boolean at the currentwriterIndexvoidwriteNullableInt(Integer value) Sets the specified (potentiallynull) 32-bit integer at the currentwriterIndexand increases thewriterIndexby4in this buffer.voidwriteNullableLong(Long value) Sets the specified (potentiallynull) 64-bit long integer at the currentwriterIndexand increases thewriterIndexby8in this buffer.voidSets the specified SimpleString (potentiallynull) at the currentwriterIndexvoidSets the specified String (potentiallynull) at the currentwriterIndexvoidwriterIndex(int writerIndex) Sets thewriterIndexof this buffer.voidwriteShort(short value) Sets the specified 16-bit short integer at the currentwriterIndexand increases thewriterIndexby2in this buffer.voidSets the specified non-null SimpleString at the currentwriterIndexvoidwriteString(String val) Sets the specified non-null String at the currentwriterIndexvoidSets the specified UTF-8 String at the currentwriterIndexMethods inherited from class org.apache.activemq.artemis.core.buffers.impl.ChannelBufferWrapper
byteBuf, capacity, copy, copy, discardReadBytes, duplicate, getByte, getBytes, getBytes, getBytes, getBytes, getBytes, getBytes, getChar, getDouble, getFloat, getInt, getLong, getShort, getUnsignedByte, getUnsignedInt, getUnsignedShort, markReaderIndex, markWriterIndex, readable, readableBytes, readBoolean, readByte, readBytes, readBytes, readBytes, readBytes, readBytes, readBytes, readChar, readDouble, readerIndex, readFloat, readFully, readFully, readInt, readLine, readLong, readNullableBoolean, readNullableInt, readNullableLong, readNullableSimpleString, readNullableString, readShort, readSimpleString, readSlice, readString, readUnsignedByte, readUnsignedInt, readUnsignedShort, readUTF, release, skipBytes, slice, slice, toByteBuffer, toByteBuffer, unwrap, writable, writableBytes, writerIndex
-
Constructor Details
-
ResetLimitWrappedActiveMQBuffer
-
ResetLimitWrappedActiveMQBuffer
-
-
Method Details
-
setMessage
We need to turn of notifications of body changes on reset on the server side when dealing with AMQP conversions, for that reason this method will set the message to null here -
clear
public void clear()Description copied from interface:ActiveMQBufferSets thereaderIndexandwriterIndexof this buffer to0. This method is identical tosetIndex(0, 0).Please note that the behavior of this method is different from that of NIO buffer, which sets the
limitto thecapacityof the buffer.- Specified by:
clearin interfaceActiveMQBuffer- Overrides:
clearin classChannelBufferWrapper
-
readerIndex
public void readerIndex(int readerIndex) Description copied from interface:ActiveMQBufferSets thereaderIndexof this buffer.- Specified by:
readerIndexin interfaceActiveMQBuffer- Overrides:
readerIndexin classChannelBufferWrapper- Parameters:
readerIndex- The reader's index
-
resetReaderIndex
public void resetReaderIndex()Description copied from interface:ActiveMQBufferRepositions the currentreaderIndexto the markedreaderIndexin this buffer.- Specified by:
resetReaderIndexin interfaceActiveMQBuffer- Overrides:
resetReaderIndexin classChannelBufferWrapper
-
resetWriterIndex
public void resetWriterIndex()Description copied from interface:ActiveMQBufferRepositions the currentwriterIndexto the markedwriterIndexin this buffer.- Specified by:
resetWriterIndexin interfaceActiveMQBuffer- Overrides:
resetWriterIndexin classChannelBufferWrapper
-
setIndex
public void setIndex(int readerIndex, int writerIndex) Description copied from interface:ActiveMQBufferSets thereaderIndexandwriterIndexof this buffer in one shot. This method is useful when you have to worry about the invocation order ofActiveMQBuffer.readerIndex(int)andActiveMQBuffer.writerIndex(int)methods. For example, the following code will fail:// Create a buffer whose readerIndex, writerIndex and capacity are // 0, 0 and 8 respectively. ChannelBuffer buf = ChannelBuffers.buffer(8); // IndexOutOfBoundsException is thrown because the specified // readerIndex (2) cannot be greater than the current writerIndex (0). buf.readerIndex(2); buf.writerIndex(4);
The following code will also fail:
// Create a buffer whose readerIndex, writerIndex and capacity are // 0, 8 and 8 respectively. ChannelBuffer buf = ChannelBuffers.wrappedBuffer(new byte[8]); // readerIndex becomes 8. buf.readLong(); // IndexOutOfBoundsException is thrown because the specified // writerIndex (4) cannot be less than the current readerIndex (8). buf.writerIndex(4); buf.readerIndex(2);
By contrast,
ActiveMQBuffer.setIndex(int, int)guarantees that it never throws anIndexOutOfBoundsExceptionas long as the specified indexes meet basic constraints, regardless what the current index values of the buffer are:// No matter what the current state of the buffer is, the following // call always succeeds as long as the capacity of the buffer is not // less than 4. buf.setIndex(2, 4);
- Specified by:
setIndexin interfaceActiveMQBuffer- Overrides:
setIndexin classChannelBufferWrapper- Parameters:
readerIndex- The reader's indexwriterIndex- The writer's index
-
writerIndex
public void writerIndex(int writerIndex) Description copied from interface:ActiveMQBufferSets thewriterIndexof this buffer.- Specified by:
writerIndexin interfaceActiveMQBuffer- Overrides:
writerIndexin classChannelBufferWrapper- Parameters:
writerIndex- The writer's index
-
setByte
public void setByte(int index, byte value) Description copied from interface:ActiveMQBufferSets the specified byte at the specified absoluteindexin this buffer. This method does not modifyreaderIndexorwriterIndexof this buffer.- Specified by:
setBytein interfaceActiveMQBuffer- Overrides:
setBytein classChannelBufferWrapper- Parameters:
index- Index into the buffervalue- The specified byte
-
setBytes
public void setBytes(int index, byte[] src, int srcIndex, int length) Description copied from interface:ActiveMQBufferTransfers the specified source array's data to this buffer starting at the specified absoluteindex. This method does not modifyreaderIndexorwriterIndexof this buffer.- Specified by:
setBytesin interfaceActiveMQBuffer- Overrides:
setBytesin classChannelBufferWrapper- Parameters:
index- Index into the buffersrc- The source buffersrcIndex- The source buffer indexlength- The number of bytes to transfer
-
setBytes
public void setBytes(int index, byte[] src) Description copied from interface:ActiveMQBufferTransfers the specified source array's data to this buffer starting at the specified absoluteindex. This method does not modifyreaderIndexorwriterIndexof this buffer.- Specified by:
setBytesin interfaceActiveMQBuffer- Overrides:
setBytesin classChannelBufferWrapper- Parameters:
index- Index into the buffersrc- The source buffer
-
setBytes
Description copied from interface:ActiveMQBufferTransfers the specified source buffer's data to this buffer starting at the specified absoluteindexuntil the source buffer's position reaches its limit. This method does not modifyreaderIndexorwriterIndexof this buffer.- Specified by:
setBytesin interfaceActiveMQBuffer- Overrides:
setBytesin classChannelBufferWrapper- Parameters:
index- Index into the buffersrc- The source buffer
-
setBytes
Description copied from interface:ActiveMQBufferTransfers the specified source buffer's data to this buffer starting at the specified absoluteindex. This method does not modifyreaderIndexorwriterIndexof both the source (i.e.this) and the destination.- Specified by:
setBytesin interfaceActiveMQBuffer- Overrides:
setBytesin classChannelBufferWrapper- Parameters:
index- Index into the buffersrc- The source bufferIndex the first index of the sourcesrcIndex- The source buffer indexlength- The number of bytes to transfer
-
setBytes
Description copied from interface:ActiveMQBufferTransfers the specified source buffer's data to this buffer starting at the specified absoluteindex. This method is basically same withActiveMQBuffer.setBytes(int, ActiveMQBuffer, int, int), except that this method increases thereaderIndexof the source buffer by the number of the transferred bytes whileActiveMQBuffer.getBytes(int, ActiveMQBuffer, int, int)does not. This method does not modifyreaderIndexorwriterIndexof the source buffer (i.e.this).- Specified by:
setBytesin interfaceActiveMQBuffer- Overrides:
setBytesin classChannelBufferWrapper- Parameters:
index- Index into the buffersrc- The source bufferlength- the number of bytes to transfer
-
setBytes
Description copied from interface:ActiveMQBufferTransfers the specified source buffer's data to this buffer starting at the specified absoluteindexuntil the destination becomes unreadable. This method is basically same withActiveMQBuffer.setBytes(int, ActiveMQBuffer, int, int), except that this method increases thereaderIndexof the source buffer by the number of the transferred bytes whileActiveMQBuffer.getBytes(int, ActiveMQBuffer, int, int)does not. This method does not modifyreaderIndexorwriterIndexof the source buffer (i.e.this).- Specified by:
setBytesin interfaceActiveMQBuffer- Overrides:
setBytesin classChannelBufferWrapper- Parameters:
index- Index into the buffersrc- The source buffer
-
setChar
public void setChar(int index, char value) Description copied from interface:ActiveMQBufferSets the specified char at the specified absoluteindexin this buffer. This method does not modifyreaderIndexorwriterIndexof this buffer.- Specified by:
setCharin interfaceActiveMQBuffer- Overrides:
setCharin classChannelBufferWrapper- Parameters:
index- Index into the buffervalue- The specified char
-
setDouble
public void setDouble(int index, double value) Description copied from interface:ActiveMQBufferSets the specified double at the specified absoluteindexin this buffer. This method does not modifyreaderIndexorwriterIndexof this buffer.- Specified by:
setDoublein interfaceActiveMQBuffer- Overrides:
setDoublein classChannelBufferWrapper- Parameters:
index- Index into the buffervalue- The specified double
-
setFloat
public void setFloat(int index, float value) Description copied from interface:ActiveMQBufferSets the specified float at the specified absoluteindexin this buffer. This method does not modifyreaderIndexorwriterIndexof this buffer.- Specified by:
setFloatin interfaceActiveMQBuffer- Overrides:
setFloatin classChannelBufferWrapper- Parameters:
index- Index into the buffervalue- The specified float
-
setInt
public void setInt(int index, int value) Description copied from interface:ActiveMQBufferSets the specified 32-bit integer at the specified absoluteindexin this buffer. This method does not modifyreaderIndexorwriterIndexof this buffer.- Specified by:
setIntin interfaceActiveMQBuffer- Overrides:
setIntin classChannelBufferWrapper- Parameters:
index- Index into the buffervalue- The specified 32-bit integer
-
setLong
public void setLong(int index, long value) Description copied from interface:ActiveMQBufferSets the specified 64-bit long integer at the specified absoluteindexin this buffer. This method does not modifyreaderIndexorwriterIndexof this buffer.- Specified by:
setLongin interfaceActiveMQBuffer- Overrides:
setLongin classChannelBufferWrapper- Parameters:
index- Index into the buffervalue- The specified 64-bit long integer
-
setShort
public void setShort(int index, short value) Description copied from interface:ActiveMQBufferSets the specified 16-bit short integer at the specified absoluteindexin this buffer. This method does not modifyreaderIndexorwriterIndexof this buffer.- Specified by:
setShortin interfaceActiveMQBuffer- Overrides:
setShortin classChannelBufferWrapper- Parameters:
index- Index into the buffervalue- The specified 16-bit short integer
-
writeBoolean
public void writeBoolean(boolean val) Description copied from interface:ActiveMQBufferSets the specified boolean at the currentwriterIndex- Specified by:
writeBooleanin interfaceActiveMQBuffer- Overrides:
writeBooleanin classChannelBufferWrapper- Parameters:
val- The specified boolean
-
writeNullableBoolean
Description copied from interface:ActiveMQBufferSets the specified (potentiallynull) Boolean at the currentwriterIndex- Specified by:
writeNullableBooleanin interfaceActiveMQBuffer- Overrides:
writeNullableBooleanin classChannelBufferWrapper- Parameters:
val- The specified boolean
-
writeByte
public void writeByte(byte value) Description copied from interface:ActiveMQBufferSets the specified byte at the currentwriterIndexand increases thewriterIndexby1in this buffer.- Specified by:
writeBytein interfaceActiveMQBuffer- Overrides:
writeBytein classChannelBufferWrapper- Parameters:
value- The specified byte
-
writeBytes
public void writeBytes(byte[] src, int srcIndex, int length) Description copied from interface:ActiveMQBufferTransfers the specified source array's data to this buffer starting at the currentwriterIndexand increases thewriterIndexby the number of the transferred bytes (=length).- Specified by:
writeBytesin interfaceActiveMQBuffer- Overrides:
writeBytesin classChannelBufferWrapper- Parameters:
src- The source buffersrcIndex- the first index of the sourcelength- the number of bytes to transfer
-
writeBytes
public void writeBytes(byte[] src) Description copied from interface:ActiveMQBufferTransfers the specified source array's data to this buffer starting at the currentwriterIndexand increases thewriterIndexby the number of the transferred bytes (=src.length).- Specified by:
writeBytesin interfaceActiveMQBuffer- Overrides:
writeBytesin classChannelBufferWrapper- Parameters:
src- The source buffer
-
writeBytes
Description copied from interface:ActiveMQBufferTransfers the specified source buffer's data to this buffer starting at the currentwriterIndexuntil the source buffer's position reaches its limit, and increases thewriterIndexby the number of the transferred bytes.- Specified by:
writeBytesin interfaceActiveMQBuffer- Overrides:
writeBytesin classChannelBufferWrapper- Parameters:
src- The source buffer
-
writeBytes
public void writeBytes(io.netty.buffer.ByteBuf src, int srcIndex, int length) Description copied from interface:ActiveMQBufferTransfers the specified source buffer's data to this buffer starting at the currentwriterIndexuntil the source buffer's position reaches its limit, and increases thewriterIndexby the number of the transferred bytes.- Specified by:
writeBytesin interfaceActiveMQBuffer- Overrides:
writeBytesin classChannelBufferWrapper- Parameters:
src- The source buffer
-
writeBytes
Description copied from interface:ActiveMQBufferTransfers the specified source buffer's data to this buffer starting at the currentwriterIndexand increases thewriterIndexby the number of the transferred bytes (=length).- Specified by:
writeBytesin interfaceActiveMQBuffer- Overrides:
writeBytesin classChannelBufferWrapper- Parameters:
src- The source buffersrcIndex- the first index of the sourcelength- the number of bytes to transfer
-
writeBytes
Description copied from interface:ActiveMQBufferTransfers the specified source buffer's data to this buffer starting at the currentwriterIndexand increases thewriterIndexby the number of the transferred bytes (=length). This method is basically same withActiveMQBuffer.writeBytes(ActiveMQBuffer, int, int), except that this method increases thereaderIndexof the source buffer by the number of the transferred bytes (=length) whileActiveMQBuffer.writeBytes(ActiveMQBuffer, int, int)does not.- Specified by:
writeBytesin interfaceActiveMQBuffer- Overrides:
writeBytesin classChannelBufferWrapper- Parameters:
src- The source bufferlength- the number of bytes to transfer
-
writeChar
public void writeChar(char chr) Description copied from interface:ActiveMQBufferSets the specified char at the currentwriterIndexand increases thewriterIndexby2in this buffer.- Specified by:
writeCharin interfaceActiveMQBuffer- Overrides:
writeCharin classChannelBufferWrapper- Parameters:
chr- The specified char
-
writeDouble
public void writeDouble(double value) Description copied from interface:ActiveMQBufferSets the specified double at the currentwriterIndexand increases thewriterIndexby8in this buffer.- Specified by:
writeDoublein interfaceActiveMQBuffer- Overrides:
writeDoublein classChannelBufferWrapper- Parameters:
value- The specified double
-
writeFloat
public void writeFloat(float value) Description copied from interface:ActiveMQBufferSets the specified float at the currentwriterIndexand increases thewriterIndexby4in this buffer.- Specified by:
writeFloatin interfaceActiveMQBuffer- Overrides:
writeFloatin classChannelBufferWrapper- Parameters:
value- The specified float
-
writeInt
public void writeInt(int value) Description copied from interface:ActiveMQBufferSets the specified 32-bit integer at the currentwriterIndexand increases thewriterIndexby4in this buffer.- Specified by:
writeIntin interfaceActiveMQBuffer- Overrides:
writeIntin classChannelBufferWrapper- Parameters:
value- The specified 32-bit integer
-
writeNullableInt
Description copied from interface:ActiveMQBufferSets the specified (potentiallynull) 32-bit integer at the currentwriterIndexand increases thewriterIndexby4in this buffer.- Specified by:
writeNullableIntin interfaceActiveMQBuffer- Overrides:
writeNullableIntin classChannelBufferWrapper- Parameters:
value- The specified (potentiallynull) 32-bit integer
-
writeLong
public void writeLong(long value) Description copied from interface:ActiveMQBufferSets the specified 64-bit long integer at the currentwriterIndexand increases thewriterIndexby8in this buffer.- Specified by:
writeLongin interfaceActiveMQBuffer- Overrides:
writeLongin classChannelBufferWrapper- Parameters:
value- The specified 64-bit long integer
-
writeNullableLong
Description copied from interface:ActiveMQBufferSets the specified (potentiallynull) 64-bit long integer at the currentwriterIndexand increases thewriterIndexby8in this buffer.- Specified by:
writeNullableLongin interfaceActiveMQBuffer- Overrides:
writeNullableLongin classChannelBufferWrapper- Parameters:
value- The specified (potentiallynull) 64-bit long integer
-
writeNullableSimpleString
Description copied from interface:ActiveMQBufferSets the specified SimpleString (potentiallynull) at the currentwriterIndex- Specified by:
writeNullableSimpleStringin interfaceActiveMQBuffer- Overrides:
writeNullableSimpleStringin classChannelBufferWrapper- Parameters:
val- The specified SimpleString
-
writeNullableString
Description copied from interface:ActiveMQBufferSets the specified String (potentiallynull) at the currentwriterIndex- Specified by:
writeNullableStringin interfaceActiveMQBuffer- Overrides:
writeNullableStringin classChannelBufferWrapper- Parameters:
val- The specified String
-
writeShort
public void writeShort(short value) Description copied from interface:ActiveMQBufferSets the specified 16-bit short integer at the currentwriterIndexand increases thewriterIndexby2in this buffer.- Specified by:
writeShortin interfaceActiveMQBuffer- Overrides:
writeShortin classChannelBufferWrapper- Parameters:
value- The specified 16-bit short integer
-
writeSimpleString
Description copied from interface:ActiveMQBufferSets the specified non-null SimpleString at the currentwriterIndex- Specified by:
writeSimpleStringin interfaceActiveMQBuffer- Overrides:
writeSimpleStringin classChannelBufferWrapper- Parameters:
val- The specified non-null SimpleString
-
writeString
Description copied from interface:ActiveMQBufferSets the specified non-null String at the currentwriterIndex- Specified by:
writeStringin interfaceActiveMQBuffer- Overrides:
writeStringin classChannelBufferWrapper- Parameters:
val- The specified non-null String
-
writeUTF
Description copied from interface:ActiveMQBufferSets the specified UTF-8 String at the currentwriterIndex- Specified by:
writeUTFin interfaceActiveMQBuffer- Overrides:
writeUTFin classChannelBufferWrapper- Parameters:
utf- The specified UTF-8 String
-