Class ChannelBufferWrapper
java.lang.Object
org.apache.activemq.artemis.core.buffers.impl.ChannelBufferWrapper
- All Implemented Interfaces:
DataInput,ActiveMQBuffer
- Direct Known Subclasses:
ResetLimitWrappedActiveMQBuffer
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionChannelBufferWrapper(io.netty.buffer.ByteBuf buffer) ChannelBufferWrapper(io.netty.buffer.ByteBuf buffer, boolean releasable) ChannelBufferWrapper(io.netty.buffer.ByteBuf buffer, boolean releasable, boolean pooled) -
Method Summary
Modifier and TypeMethodDescriptionio.netty.buffer.ByteBufbyteBuf()Returns the underlying Netty's ByteBuf.intcapacity()Returns the number of bytes this buffer can contain.voidclear()Sets thereaderIndexandwriterIndexof this buffer to0.copy()Returns a copy of this buffer's readable bytes.copy(int index, int length) Returns a copy of this buffer's sub-region.voidDiscards the bytes between the 0th index andreaderIndex.Returns a buffer which shares the whole region of this buffer.bytegetByte(int index) Gets a byte at the specified absoluteindexin this buffer.voidgetBytes(int index, byte[] dst) Transfers this buffer's data to the specified destination starting at the specified absoluteindex.voidgetBytes(int index, byte[] dst, int dstIndex, int length) Transfers this buffer's data to the specified destination starting at the specified absoluteindex.voidgetBytes(int index, ByteBuffer dst) Transfers this buffer's data to the specified destination starting at the specified absoluteindexuntil the destination's position reaches its limit.voidgetBytes(int index, ActiveMQBuffer dst) Transfers this buffer's data to the specified destination starting at the specified absoluteindexuntil the destination becomes non-writable.voidgetBytes(int index, ActiveMQBuffer dst, int length) Transfers this buffer's data to the specified destination starting at the specified absoluteindex.voidgetBytes(int index, ActiveMQBuffer dst, int dstIndex, int length) Transfers this buffer's data to the specified destination starting at the specified absoluteindex.chargetChar(int index) Gets a char at the specified absoluteindexin this buffer.doublegetDouble(int index) Gets a double at the specified absoluteindexin this buffer.floatgetFloat(int index) Gets a float at the specified absoluteindexin this buffer.intgetInt(int index) Gets a 32-bit integer at the specified absoluteindexin this buffer.longgetLong(int index) Gets a 64-bit long integer at the specified absoluteindexin this buffer.shortgetShort(int index) Gets a 16-bit short integer at the specified absoluteindexin this buffer.shortgetUnsignedByte(int index) Gets an unsigned byte at the specified absoluteindexin this buffer.longgetUnsignedInt(int index) Gets an unsigned 32-bit integer at the specified absoluteindexin this buffer.intgetUnsignedShort(int index) Gets an unsigned 16-bit short integer at the specified absoluteindexin this buffer.voidMarks the currentreaderIndexin this buffer.voidMarks the currentwriterIndexin this buffer.booleanreadable()Returnstrueif and only if(this.writerIndex - this.readerIndex)is greater than0.intReturns the number of readable bytes which is equal to(this.writerIndex - this.readerIndex).booleanGets a boolean at the currentreaderIndexand increases thereaderIndexby1in this buffer.bytereadByte()Gets a byte at the currentreaderIndexand increases thereaderIndexby1in this buffer.voidreadBytes(byte[] dst) Transfers this buffer's data to the specified destination starting at the currentreaderIndexand increases thereaderIndexby the number of the transferred bytes (=dst.length).voidreadBytes(byte[] dst, int dstIndex, int length) Transfers this buffer's data to the specified destination starting at the currentreaderIndexand increases thereaderIndexby the number of the transferred bytes (=length).voidreadBytes(ByteBuffer dst) Transfers this buffer's data to the specified destination starting at the currentreaderIndexuntil the destination's position reaches its limit, and increases thereaderIndexby the number of the transferred bytes.voidreadBytes(ActiveMQBuffer dst) Transfers this buffer's data to the specified destination starting at the currentreaderIndexuntil the destination becomes non-writable, and increases thereaderIndexby the number of the transferred bytes.voidreadBytes(ActiveMQBuffer dst, int length) Transfers this buffer's data to the specified destination starting at the currentreaderIndexand increases thereaderIndexby the number of the transferred bytes (=length).voidreadBytes(ActiveMQBuffer dst, int dstIndex, int length) Transfers this buffer's data to the specified destination starting at the currentreaderIndexand increases thereaderIndexby the number of the transferred bytes (=length).charreadChar()Gets a char at the currentreaderIndexand increases thereaderIndexby2in this buffer.doubleGets a double at the currentreaderIndexand increases thereaderIndexby8in this buffer.intReturns thereaderIndexof this buffer..voidreaderIndex(int readerIndex) Sets thereaderIndexof this buffer.floatGets a float at the currentreaderIndexand increases thereaderIndexby4in this buffer.voidreadFully(byte[] b) fromDataInputinterfacevoidreadFully(byte[] b, int off, int len) fromDataInputinterfaceintreadInt()Gets a 32-bit integer at the currentreaderIndexand increases thereaderIndexby4in this buffer.readLine()fromDataInputinterfacelongreadLong()Gets a 64-bit integer at the currentreaderIndexand increases thereaderIndexby8in this buffer.Gets a (potentiallynull) boolean at the currentreaderIndexand increases thereaderIndexby1in this buffer.Gets a (potentiallynull) 32-bit integer at the currentreaderIndexand increases thereaderIndexby4in this buffer.Gets a (potentiallynull) 64-bit integer at the currentreaderIndexand increases thereaderIndexby8in this buffer.Gets a SimpleString (potentiallynull) at the currentreaderIndexGets a String (potentiallynull) at the currentreaderIndexshortGets a 16-bit short integer at the currentreaderIndexand increases thereaderIndexby2in this buffer.Gets a non-null SimpleString at the currentreaderIndexreadSlice(int length) Returns a new slice of this buffer's sub-region starting at the currentreaderIndexand increases thereaderIndexby the size of the new slice (=length).Gets a non-null String at the currentreaderIndexintGets an unsigned byte at the currentreaderIndexand increases thereaderIndexby1in this buffer.longGets an unsigned 32-bit integer at the currentreaderIndexand increases thereaderIndexby4in this buffer.intGets an unsigned 16-bit short integer at the currentreaderIndexand increases thereaderIndexby2in this buffer.readUTF()Gets a UTF-8 String at the currentreaderIndexvoidrelease()Release any underlying resources held by this buffervoidRepositions 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.voidsetShort(int index, short value) Sets the specified 16-bit short integer at the specified absoluteindexin this buffer.intskipBytes(int length) Increases the currentreaderIndexby the specifiedlengthin this buffer.slice()Returns a slice of this buffer's readable bytes.slice(int index, int length) Returns a slice of this buffer's sub-region.Converts this buffer's readable bytes into a NIO buffer.toByteBuffer(int index, int length) Converts this buffer's sub-region into a NIO buffer.static io.netty.buffer.ByteBufunwrap(io.netty.buffer.ByteBuf buffer) booleanwritable()Returnstrueif and only if(this.capacity - this.writerIndex)is greater than0.intReturns the number of writable bytes which is equal to(this.capacity - this.writerIndex).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 currentwriterIndexintReturns thewriterIndexof this buffer..voidwriterIndex(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 currentwriterIndex
-
Field Details
-
buffer
protected final io.netty.buffer.ByteBuf buffer
-
-
Constructor Details
-
ChannelBufferWrapper
public ChannelBufferWrapper(io.netty.buffer.ByteBuf buffer) -
ChannelBufferWrapper
public ChannelBufferWrapper(io.netty.buffer.ByteBuf buffer, boolean releasable) -
ChannelBufferWrapper
public ChannelBufferWrapper(io.netty.buffer.ByteBuf buffer, boolean releasable, boolean pooled)
-
-
Method Details
-
unwrap
public static io.netty.buffer.ByteBuf unwrap(io.netty.buffer.ByteBuf buffer) -
readBoolean
public boolean readBoolean()Description copied from interface:ActiveMQBufferGets a boolean at the currentreaderIndexand increases thereaderIndexby1in this buffer.- Specified by:
readBooleanin interfaceActiveMQBuffer- Specified by:
readBooleanin interfaceDataInput- Returns:
- a boolean at the current
readerIndex
-
readNullableBoolean
Description copied from interface:ActiveMQBufferGets a (potentiallynull) boolean at the currentreaderIndexand increases thereaderIndexby1in this buffer.- Specified by:
readNullableBooleanin interfaceActiveMQBuffer- Returns:
- a (potentially
null) boolean at the currentreaderIndex
-
readNullableSimpleString
Description copied from interface:ActiveMQBufferGets a SimpleString (potentiallynull) at the currentreaderIndex- Specified by:
readNullableSimpleStringin interfaceActiveMQBuffer- Returns:
- a SimpleString (potentially
null) at the currentreaderIndex
-
readNullableString
Description copied from interface:ActiveMQBufferGets a String (potentiallynull) at the currentreaderIndex- Specified by:
readNullableStringin interfaceActiveMQBuffer- Returns:
- a String (potentially
null) at the currentreaderIndex
-
readSimpleString
Description copied from interface:ActiveMQBufferGets a non-null SimpleString at the currentreaderIndex- Specified by:
readSimpleStringin interfaceActiveMQBuffer- Returns:
- a non-null SimpleString at the current
readerIndex
-
readString
Description copied from interface:ActiveMQBufferGets a non-null String at the currentreaderIndex- Specified by:
readStringin interfaceActiveMQBuffer- Returns:
- a non-null String at the current
readerIndex
-
writeNullableString
Description copied from interface:ActiveMQBufferSets the specified String (potentiallynull) at the currentwriterIndex- Specified by:
writeNullableStringin interfaceActiveMQBuffer- Parameters:
val- The specified String
-
writeUTF
Description copied from interface:ActiveMQBufferSets the specified UTF-8 String at the currentwriterIndex- Specified by:
writeUTFin interfaceActiveMQBuffer- Parameters:
utf- The specified UTF-8 String
-
readUTF
Description copied from interface:ActiveMQBufferGets a UTF-8 String at the currentreaderIndex- Specified by:
readUTFin interfaceActiveMQBuffer- Specified by:
readUTFin interfaceDataInput- Returns:
- a UTF-8 String at the current
readerIndex
-
writeBoolean
public void writeBoolean(boolean val) Description copied from interface:ActiveMQBufferSets the specified boolean at the currentwriterIndex- Specified by:
writeBooleanin interfaceActiveMQBuffer- Parameters:
val- The specified boolean
-
writeNullableBoolean
Description copied from interface:ActiveMQBufferSets the specified (potentiallynull) Boolean at the currentwriterIndex- Specified by:
writeNullableBooleanin interfaceActiveMQBuffer- Parameters:
val- The specified boolean
-
writeNullableSimpleString
Description copied from interface:ActiveMQBufferSets the specified SimpleString (potentiallynull) at the currentwriterIndex- Specified by:
writeNullableSimpleStringin interfaceActiveMQBuffer- Parameters:
val- The specified SimpleString
-
writeSimpleString
Description copied from interface:ActiveMQBufferSets the specified non-null SimpleString at the currentwriterIndex- Specified by:
writeSimpleStringin interfaceActiveMQBuffer- 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- Parameters:
val- The specified non-null String
-
capacity
public int capacity()Description copied from interface:ActiveMQBufferReturns the number of bytes this buffer can contain.- Specified by:
capacityin interfaceActiveMQBuffer- Returns:
- the number of bytes this buffer can contain
-
byteBuf
public io.netty.buffer.ByteBuf byteBuf()Description copied from interface:ActiveMQBufferReturns the underlying Netty's ByteBuf.- Specified by:
byteBufin interfaceActiveMQBuffer- Returns:
- the underlying Netty's ByteBuf
-
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
-
copy
Description copied from interface:ActiveMQBufferReturns a copy of this buffer's readable bytes. Modifying the content of the returned buffer or this buffer does not affect each other at all. This method is identical tobuf.copy(buf.readerIndex(), buf.readableBytes()). This method does not modifyreaderIndexorwriterIndexof this buffer.- Specified by:
copyin interfaceActiveMQBuffer- Returns:
- a copy of this buffer's readable bytes
-
copy
Description copied from interface:ActiveMQBufferReturns a copy of this buffer's sub-region. Modifying the content of the returned buffer or this buffer does not affect each other at all. This method does not modifyreaderIndexorwriterIndexof this buffer.- Specified by:
copyin interfaceActiveMQBuffer- Parameters:
index- Index into the bufferlength- The number of bytes to copy- Returns:
- a copy of this buffer's readable bytes
-
discardReadBytes
public void discardReadBytes()Description copied from interface:ActiveMQBufferDiscards the bytes between the 0th index andreaderIndex. It moves the bytes betweenreaderIndexandwriterIndexto the 0th index, and setsreaderIndexandwriterIndexto0andoldWriterIndex - oldReaderIndexrespectively.Please refer to the class documentation for more detailed explanation.
- Specified by:
discardReadBytesin interfaceActiveMQBuffer
-
duplicate
Description copied from interface:ActiveMQBufferReturns a buffer which shares the whole region of this buffer. Modifying the content of the returned buffer or this buffer affects each other's content while they maintain separate indexes and marks. This method is identical tobuf.slice(0, buf.capacity()). This method does not modifyreaderIndexorwriterIndexof this buffer.- Specified by:
duplicatein interfaceActiveMQBuffer- Returns:
- a buffer which shares the whole region of this buffer
-
getByte
public byte getByte(int index) Description copied from interface:ActiveMQBufferGets a byte at the specified absoluteindexin this buffer. This method does not modifyreaderIndexorwriterIndexof this buffer.- Specified by:
getBytein interfaceActiveMQBuffer- Parameters:
index- Index into the buffer- Returns:
- The byte at the specified index
-
getBytes
public void getBytes(int index, byte[] dst, int dstIndex, int length) Description copied from interface:ActiveMQBufferTransfers this buffer's data to the specified destination starting at the specified absoluteindex. This method does not modifyreaderIndexorwriterIndexof this buffer.- Specified by:
getBytesin interfaceActiveMQBuffer- Parameters:
index- Index into the bufferdst- The destination bufferdstIndex- The first index of the destinationlength- The number of bytes to transfer
-
getBytes
public void getBytes(int index, byte[] dst) Description copied from interface:ActiveMQBufferTransfers this buffer's data to the specified destination starting at the specified absoluteindex. This method does not modifyreaderIndexorwriterIndexof this buffer- Specified by:
getBytesin interfaceActiveMQBuffer- Parameters:
index- Index into the bufferdst- The destination buffer
-
getBytes
Description copied from interface:ActiveMQBufferTransfers this buffer's data to the specified destination starting at the specified absoluteindexuntil the destination's position reaches its limit. This method does not modifyreaderIndexorwriterIndexof this buffer while the destination'spositionwill be increased.- Specified by:
getBytesin interfaceActiveMQBuffer- Parameters:
index- Index into the bufferdst- The destination buffer
-
getBytes
Description copied from interface:ActiveMQBufferTransfers this buffer's data to the specified destination starting at the specified absoluteindex. This method does not modifyreaderIndexorwriterIndexof both the source (i.e.this) and the destination.- Specified by:
getBytesin interfaceActiveMQBuffer- Parameters:
index- Index into the bufferdst- The destination bufferIndex the first index of the destinationdstIndex- The index into the destination bufferThe destination bufferlength- The number of bytes to transfer
-
getBytes
Description copied from interface:ActiveMQBufferTransfers this buffer's data to the specified destination starting at the specified absoluteindex. This method is basically same withActiveMQBuffer.getBytes(int, ActiveMQBuffer, int, int), except that this method increases thewriterIndexof the destination 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:
getBytesin interfaceActiveMQBuffer- Parameters:
index- Index into the bufferdst- The destination bufferlength- the number of bytes to transfer
-
getBytes
Description copied from interface:ActiveMQBufferTransfers this buffer's data to the specified destination starting at the specified absoluteindexuntil the destination becomes non-writable. This method is basically same withActiveMQBuffer.getBytes(int, ActiveMQBuffer, int, int), except that this method increases thewriterIndexof the destination 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:
getBytesin interfaceActiveMQBuffer- Parameters:
index- Index into the bufferdst- The destination buffer
-
getChar
public char getChar(int index) Description copied from interface:ActiveMQBufferGets a char at the specified absoluteindexin this buffer. This method does not modifyreaderIndexorwriterIndexof this buffer.- Specified by:
getCharin interfaceActiveMQBuffer- Parameters:
index- Index into the buffer- Returns:
- a char at the specified absolute
index
-
getDouble
public double getDouble(int index) Description copied from interface:ActiveMQBufferGets a double at the specified absoluteindexin this buffer. This method does not modifyreaderIndexorwriterIndexof this buffer.- Specified by:
getDoublein interfaceActiveMQBuffer- Parameters:
index- Index into the buffer- Returns:
- a double at the specified absolute
index
-
getFloat
public float getFloat(int index) Description copied from interface:ActiveMQBufferGets a float at the specified absoluteindexin this buffer. This method does not modifyreaderIndexorwriterIndexof this buffer.- Specified by:
getFloatin interfaceActiveMQBuffer- Parameters:
index- Index into the buffer- Returns:
- a float at the specified absolute
index
-
getInt
public int getInt(int index) Description copied from interface:ActiveMQBufferGets a 32-bit integer at the specified absoluteindexin this buffer. This method does not modifyreaderIndexorwriterIndexof this buffer.- Specified by:
getIntin interfaceActiveMQBuffer- Parameters:
index- Index into the buffer- Returns:
- a 32-bit integer at the specified absolute
index
-
getLong
public long getLong(int index) Description copied from interface:ActiveMQBufferGets a 64-bit long integer at the specified absoluteindexin this buffer. This method does not modifyreaderIndexorwriterIndexof this buffer.- Specified by:
getLongin interfaceActiveMQBuffer- Parameters:
index- Index into the buffer- Returns:
- a 64-bit long integer at the specified absolute
index
-
getShort
public short getShort(int index) Description copied from interface:ActiveMQBufferGets a 16-bit short integer at the specified absoluteindexin this buffer. This method does not modifyreaderIndexorwriterIndexof this buffer.- Specified by:
getShortin interfaceActiveMQBuffer- Parameters:
index- Index into the buffer- Returns:
- a 16-bit short integer at the specified absolute
index
-
getUnsignedByte
public short getUnsignedByte(int index) Description copied from interface:ActiveMQBufferGets an unsigned byte at the specified absoluteindexin this buffer. This method does not modifyreaderIndexorwriterIndexof this buffer.- Specified by:
getUnsignedBytein interfaceActiveMQBuffer- Parameters:
index- Index into the buffer- Returns:
- an unsigned byte at the specified absolute
index
-
getUnsignedInt
public long getUnsignedInt(int index) Description copied from interface:ActiveMQBufferGets an unsigned 32-bit integer at the specified absoluteindexin this buffer. This method does not modifyreaderIndexorwriterIndexof this buffer.- Specified by:
getUnsignedIntin interfaceActiveMQBuffer- Parameters:
index- The index into this buffer- Returns:
- an unsigned 32-bit integer at the specified absolute
index
-
getUnsignedShort
public int getUnsignedShort(int index) Description copied from interface:ActiveMQBufferGets an unsigned 16-bit short integer at the specified absoluteindexin this buffer. This method does not modifyreaderIndexorwriterIndexof this buffer.- Specified by:
getUnsignedShortin interfaceActiveMQBuffer- Parameters:
index- Index into the buffer- Returns:
- an unsigned 16-bit short integer
-
markReaderIndex
public void markReaderIndex()Description copied from interface:ActiveMQBufferMarks the currentreaderIndexin this buffer. You can reposition the currentreaderIndexto the markedreaderIndexby callingActiveMQBuffer.resetReaderIndex(). The initial value of the markedreaderIndexis0.- Specified by:
markReaderIndexin interfaceActiveMQBuffer
-
markWriterIndex
public void markWriterIndex()Description copied from interface:ActiveMQBufferMarks the currentwriterIndexin this buffer. You can reposition the currentwriterIndexto the markedwriterIndexby callingActiveMQBuffer.resetWriterIndex(). The initial value of the markedwriterIndexis0.- Specified by:
markWriterIndexin interfaceActiveMQBuffer
-
readable
public boolean readable()Description copied from interface:ActiveMQBufferReturnstrueif and only if(this.writerIndex - this.readerIndex)is greater than0.- Specified by:
readablein interfaceActiveMQBuffer- Returns:
trueif and only if(this.writerIndex - this.readerIndex)is greater than0
-
readableBytes
public int readableBytes()Description copied from interface:ActiveMQBufferReturns the number of readable bytes which is equal to(this.writerIndex - this.readerIndex).- Specified by:
readableBytesin interfaceActiveMQBuffer- Returns:
- the number of readable bytes which is equal to
(this.writerIndex - this.readerIndex)
-
readByte
public byte readByte()Description copied from interface:ActiveMQBufferGets a byte at the currentreaderIndexand increases thereaderIndexby1in this buffer.- Specified by:
readBytein interfaceActiveMQBuffer- Specified by:
readBytein interfaceDataInput- Returns:
- a byte at the current
readerIndex
-
readBytes
public void readBytes(byte[] dst, int dstIndex, int length) Description copied from interface:ActiveMQBufferTransfers this buffer's data to the specified destination starting at the currentreaderIndexand increases thereaderIndexby the number of the transferred bytes (=length).- Specified by:
readBytesin interfaceActiveMQBuffer- Parameters:
dst- The destination bufferdstIndex- The destination bufferIndexlength- the number of bytes to transfer
-
readBytes
public void readBytes(byte[] dst) Description copied from interface:ActiveMQBufferTransfers this buffer's data to the specified destination starting at the currentreaderIndexand increases thereaderIndexby the number of the transferred bytes (=dst.length).- Specified by:
readBytesin interfaceActiveMQBuffer- Parameters:
dst- The destination buffer
-
readBytes
Description copied from interface:ActiveMQBufferTransfers this buffer's data to the specified destination starting at the currentreaderIndexuntil the destination's position reaches its limit, and increases thereaderIndexby the number of the transferred bytes.- Specified by:
readBytesin interfaceActiveMQBuffer- Parameters:
dst- The destination buffer
-
readBytes
Description copied from interface:ActiveMQBufferTransfers this buffer's data to the specified destination starting at the currentreaderIndexand increases thereaderIndexby the number of the transferred bytes (=length).- Specified by:
readBytesin interfaceActiveMQBuffer- Parameters:
dst- The destination bufferdstIndex- The destination buffer indexlength- the number of bytes to transfer
-
readBytes
Description copied from interface:ActiveMQBufferTransfers this buffer's data to the specified destination starting at the currentreaderIndexand increases thereaderIndexby the number of the transferred bytes (=length). This method is basically same withActiveMQBuffer.readBytes(ActiveMQBuffer, int, int), except that this method increases thewriterIndexof the destination by the number of the transferred bytes (=length) whileActiveMQBuffer.readBytes(ActiveMQBuffer, int, int)does not.- Specified by:
readBytesin interfaceActiveMQBuffer- Parameters:
dst- The destination bufferlength- The number of bytes to transfer
-
readBytes
Description copied from interface:ActiveMQBufferTransfers this buffer's data to the specified destination starting at the currentreaderIndexuntil the destination becomes non-writable, and increases thereaderIndexby the number of the transferred bytes. This method is basically same withActiveMQBuffer.readBytes(ActiveMQBuffer, int, int), except that this method increases thewriterIndexof the destination by the number of the transferred bytes whileActiveMQBuffer.readBytes(ActiveMQBuffer, int, int)does not.- Specified by:
readBytesin interfaceActiveMQBuffer- Parameters:
dst- The destination buffer
-
readChar
public char readChar()Description copied from interface:ActiveMQBufferGets a char at the currentreaderIndexand increases thereaderIndexby2in this buffer.- Specified by:
readCharin interfaceActiveMQBuffer- Specified by:
readCharin interfaceDataInput- Returns:
- a char at the current
readerIndex
-
readDouble
public double readDouble()Description copied from interface:ActiveMQBufferGets a double at the currentreaderIndexand increases thereaderIndexby8in this buffer.- Specified by:
readDoublein interfaceActiveMQBuffer- Specified by:
readDoublein interfaceDataInput- Returns:
- a double at the current
readerIndex
-
readerIndex
public int readerIndex()Description copied from interface:ActiveMQBufferReturns thereaderIndexof this buffer..- Specified by:
readerIndexin interfaceActiveMQBuffer- Returns:
- the
readerIndexof this buffer.
-
readerIndex
public void readerIndex(int readerIndex) Description copied from interface:ActiveMQBufferSets thereaderIndexof this buffer.- Specified by:
readerIndexin interfaceActiveMQBuffer- Parameters:
readerIndex- The reader's index
-
readFloat
public float readFloat()Description copied from interface:ActiveMQBufferGets a float at the currentreaderIndexand increases thereaderIndexby4in this buffer.- Specified by:
readFloatin interfaceActiveMQBuffer- Specified by:
readFloatin interfaceDataInput- Returns:
- a float at the current
readerIndex
-
readInt
public int readInt()Description copied from interface:ActiveMQBufferGets a 32-bit integer at the currentreaderIndexand increases thereaderIndexby4in this buffer.- Specified by:
readIntin interfaceActiveMQBuffer- Specified by:
readIntin interfaceDataInput- Returns:
- a 32-bit integer at the current
readerIndex
-
readNullableInt
Description copied from interface:ActiveMQBufferGets a (potentiallynull) 32-bit integer at the currentreaderIndexand increases thereaderIndexby4in this buffer.- Specified by:
readNullableIntin interfaceActiveMQBuffer- Returns:
- a (potentially
null) 32-bit integer at the currentreaderIndex
-
readLong
public long readLong()Description copied from interface:ActiveMQBufferGets a 64-bit integer at the currentreaderIndexand increases thereaderIndexby8in this buffer.- Specified by:
readLongin interfaceActiveMQBuffer- Specified by:
readLongin interfaceDataInput- Returns:
- a 64-bit integer at the current
readerIndex
-
readNullableLong
Description copied from interface:ActiveMQBufferGets a (potentiallynull) 64-bit integer at the currentreaderIndexand increases thereaderIndexby8in this buffer.- Specified by:
readNullableLongin interfaceActiveMQBuffer- Returns:
- a (potentially
null) 64-bit integer at the currentreaderIndex
-
readShort
public short readShort()Description copied from interface:ActiveMQBufferGets a 16-bit short integer at the currentreaderIndexand increases thereaderIndexby2in this buffer.- Specified by:
readShortin interfaceActiveMQBuffer- Specified by:
readShortin interfaceDataInput- Returns:
- a 16-bit short integer at the current
readerIndex
-
readSlice
Description copied from interface:ActiveMQBufferReturns a new slice of this buffer's sub-region starting at the currentreaderIndexand increases thereaderIndexby the size of the new slice (=length).- Specified by:
readSlicein interfaceActiveMQBuffer- Parameters:
length- the size of the new slice- Returns:
- the newly created slice
-
readUnsignedByte
public int readUnsignedByte()Description copied from interface:ActiveMQBufferGets an unsigned byte at the currentreaderIndexand increases thereaderIndexby1in this buffer.- Specified by:
readUnsignedBytein interfaceActiveMQBuffer- Specified by:
readUnsignedBytein interfaceDataInput- Returns:
- an unsigned byte at the current
readerIndex
-
readUnsignedInt
public long readUnsignedInt()Description copied from interface:ActiveMQBufferGets an unsigned 32-bit integer at the currentreaderIndexand increases thereaderIndexby4in this buffer.- Specified by:
readUnsignedIntin interfaceActiveMQBuffer- Returns:
- an unsigned 32-bit integer at the current
readerIndex
-
readUnsignedShort
public int readUnsignedShort()Description copied from interface:ActiveMQBufferGets an unsigned 16-bit short integer at the currentreaderIndexand increases thereaderIndexby2in this buffer.- Specified by:
readUnsignedShortin interfaceActiveMQBuffer- Specified by:
readUnsignedShortin interfaceDataInput- Returns:
- an unsigned 16-bit short integer at the current
readerIndex
-
resetReaderIndex
public void resetReaderIndex()Description copied from interface:ActiveMQBufferRepositions the currentreaderIndexto the markedreaderIndexin this buffer.- Specified by:
resetReaderIndexin interfaceActiveMQBuffer
-
resetWriterIndex
public void resetWriterIndex()Description copied from interface:ActiveMQBufferRepositions the currentwriterIndexto the markedwriterIndexin this buffer.- Specified by:
resetWriterIndexin interfaceActiveMQBuffer
-
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- 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- 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- 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- 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- 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- 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- 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- 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- 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- Parameters:
index- Index into the buffervalue- The specified float
-
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- Parameters:
readerIndex- The reader's indexwriterIndex- The writer's index
-
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- 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- 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- Parameters:
index- Index into the buffervalue- The specified 16-bit short integer
-
skipBytes
public int skipBytes(int length) Description copied from interface:ActiveMQBufferIncreases the currentreaderIndexby the specifiedlengthin this buffer.- Specified by:
skipBytesin interfaceActiveMQBuffer- Specified by:
skipBytesin interfaceDataInput- Parameters:
length- The number of bytes to skip
-
slice
Description copied from interface:ActiveMQBufferReturns a slice of this buffer's readable bytes. Modifying the content of the returned buffer or this buffer affects each other's content while they maintain separate indexes and marks. This method is identical tobuf.slice(buf.readerIndex(), buf.readableBytes()). This method does not modifyreaderIndexorwriterIndexof this buffer.- Specified by:
slicein interfaceActiveMQBuffer- Returns:
- a slice of this buffer's readable bytes
-
slice
Description copied from interface:ActiveMQBufferReturns a slice of this buffer's sub-region. Modifying the content of the returned buffer or this buffer affects each other's content while they maintain separate indexes and marks. This method does not modifyreaderIndexorwriterIndexof this buffer.- Specified by:
slicein interfaceActiveMQBuffer- Parameters:
index- Index into the bufferlength- The number of bytes- Returns:
- a slice of this buffer's sub-region
-
toByteBuffer
Description copied from interface:ActiveMQBufferConverts this buffer's readable bytes into a NIO buffer. The returned buffer might or might not share the content with this buffer, while they have separate indexes and marks. This method is identical tobuf.toByteBuffer(buf.readerIndex(), buf.readableBytes()). This method does not modifyreaderIndexorwriterIndexof this buffer.- Specified by:
toByteBufferin interfaceActiveMQBuffer- Returns:
- A converted NIO ByteBuffer
-
toByteBuffer
Description copied from interface:ActiveMQBufferConverts this buffer's sub-region into a NIO buffer. The returned buffer might or might not share the content with this buffer, while they have separate indexes and marks. This method does not modifyreaderIndexorwriterIndexof this buffer.- Specified by:
toByteBufferin interfaceActiveMQBuffer- Parameters:
index- Index into the bufferlength- The number of bytes- Returns:
- A converted NIO Buffer
-
release
public void release()Description copied from interface:ActiveMQBufferRelease any underlying resources held by this buffer- Specified by:
releasein interfaceActiveMQBuffer
-
writable
public boolean writable()Description copied from interface:ActiveMQBufferReturnstrueif and only if(this.capacity - this.writerIndex)is greater than0.- Specified by:
writablein interfaceActiveMQBuffer- Returns:
trueif and only if(this.capacity - this.writerIndex)is greater than0
-
writableBytes
public int writableBytes()Description copied from interface:ActiveMQBufferReturns the number of writable bytes which is equal to(this.capacity - this.writerIndex).- Specified by:
writableBytesin interfaceActiveMQBuffer- Returns:
- the number of writable bytes which is equal to
(this.capacity - this.writerIndex)
-
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- 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- 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- 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- 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- 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- 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- 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- 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- 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- 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- 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- 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- 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- Parameters:
value- The specified (potentiallynull) 64-bit long integer
-
writerIndex
public int writerIndex()Description copied from interface:ActiveMQBufferReturns thewriterIndexof this buffer..- Specified by:
writerIndexin interfaceActiveMQBuffer- Returns:
- the
writerIndexof this buffer.
-
writerIndex
public void writerIndex(int writerIndex) Description copied from interface:ActiveMQBufferSets thewriterIndexof this buffer.- Specified by:
writerIndexin interfaceActiveMQBuffer- Parameters:
writerIndex- The writer's index
-
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- Parameters:
value- The specified 16-bit short integer
-
readFully
fromDataInputinterface- Specified by:
readFullyin interfaceDataInput- Throws:
IOException
-
readFully
fromDataInputinterface- Specified by:
readFullyin interfaceDataInput- Throws:
IOException
-
readLine
fromDataInputinterface- Specified by:
readLinein interfaceDataInput- Throws:
IOException
-