Class LargeMessageControllerImpl
- java.lang.Object
-
- org.apache.activemq.artemis.core.client.impl.LargeMessageControllerImpl
-
- All Implemented Interfaces:
DataInput,ActiveMQBuffer,LargeMessageController
public class LargeMessageControllerImpl extends Object implements LargeMessageController
This class aggregates severalSessionReceiveContinuationMessageas it was being handled by a single buffer. This buffer can be consumed as messages are arriving, and it will hold the packets until they are read using the ChannelBuffer interface, or the setOutputStream or saveStream are called.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classLargeMessageControllerImpl.LargeData
-
Constructor Summary
Constructors Constructor Description LargeMessageControllerImpl(ClientConsumerInternal consumerInternal, long totalSize, long readTimeout)LargeMessageControllerImpl(ClientConsumerInternal consumerInternal, long totalSize, long readTimeout, File cachedFile)LargeMessageControllerImpl(ClientConsumerInternal consumerInternal, long totalSize, long readTimeout, File cachedFile, int bufferSize)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddPacket(byte[] chunk, int flowControlSize, boolean isContinues)TODO: move this to ConsumerContext as large message is a protocol specific thing Add a buff to the List, or save it to the OutputStream if setio.netty.buffer.ByteBufbyteBuf()Returns the underlying Netty's ByteBufvoidcancel()Cancels this buffer.intcapacity()Returns the number of bytes this buffer can contain.voidclear()Sets thereaderIndexandwriterIndexof this buffer to0.voidclose()Closes this buffer.ActiveMQBuffercopy()Returns a copy of this buffer's readable bytes.ActiveMQBuffercopy(int index, int length)Returns a copy of this buffer's sub-region.voiddiscardReadBytes()Discards the bytes between the 0th index andreaderIndex.voiddiscardUnusedPackets()Discards packets unused by this buffer.ActiveMQBufferduplicate()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, OutputStream out, int length)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.intgetBytes(int index, GatheringByteChannel out, int length)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.voidgetBytes(long index, byte[] dst)voidgetBytes(long index, byte[] dst, int dstIndex, int length)voidgetBytes(long index, OutputStream out, int length)voidgetBytes(long index, ByteBuffer dst)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.intgetInt(long index)longgetLong(int index)Gets a 64-bit long integer at the specified absoluteindexin this buffer.longgetLong(long index)intgetMedium(int index)shortgetShort(int index)Gets a 16-bit short integer at the specified absoluteindexin this buffer.shortgetShort(long index)longgetSize()Returns the size of this buffer.ObjectgetUnderlyingBuffer()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.intgetUnsignedMedium(long index)intgetUnsignedShort(int index)Gets an unsigned 16-bit short integer at the specified absoluteindexin this buffer.voidmarkReaderIndex()Marks the currentreaderIndexin this buffer.voidmarkWriterIndex()Marks the currentwriterIndexin this buffer.booleanreadable()intreadableBytes()booleanreadBoolean()Gets 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(OutputStream out, int 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.intreadBytes(GatheringByteChannel out, int length)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.doublereadDouble()Gets a double at the currentreaderIndexand increases thereaderIndexby8in this buffer.intreaderIndex()voidreaderIndex(int readerIndex)Sets thereaderIndexof this buffer.floatreadFloat()Gets 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.intreadInt(int pos)StringreadLine()fromDataInputinterfacelongreadLong()Gets a 64-bit integer at the currentreaderIndexand increases thereaderIndexby8in this buffer.intreadMedium()BooleanreadNullableBoolean()Gets a (potentiallynull) boolean at the currentreaderIndexand increases thereaderIndexby1in this buffer.IntegerreadNullableInt()Gets a (potentiallynull) 32-bit integer at the currentreaderIndexand increases thereaderIndexby4in this buffer.LongreadNullableLong()Gets a (potentiallynull) 64-bit integer at the currentreaderIndexand increases thereaderIndexby8in this buffer.SimpleStringreadNullableSimpleString()Gets a SimpleString (potentiallynull) at the currentreaderIndexStringreadNullableString()Gets a String (potentiallynull) at the currentreaderIndexshortreadShort()Gets a 16-bit short integer at the currentreaderIndexand increases thereaderIndexby2in this buffer.SimpleStringreadSimpleString()Gets a non-null SimpleString at the currentreaderIndexActiveMQBufferreadSlice(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).StringreadString()Gets a non-null String at the currentreaderIndexintreadUnsignedByte()Gets an unsigned byte at the currentreaderIndexand increases thereaderIndexby1in this buffer.longreadUnsignedInt()Gets an unsigned 32-bit integer at the currentreaderIndexand increases thereaderIndexby4in this buffer.intreadUnsignedMedium()intreadUnsignedShort()Gets an unsigned 16-bit short integer at the currentreaderIndexand increases thereaderIndexby2in this buffer.StringreadUTF()Gets a UTF-8 String at the currentreaderIndexvoidrelease()Release any underlying resources held by this buffervoidresetReaderIndex()Repositions the currentreaderIndexto the markedreaderIndexin this buffer.voidresetWriterIndex()Repositions the currentwriterIndexto the markedwriterIndexin this buffer.voidsaveBuffer(OutputStream output)Saves this buffer to the specified output.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.voidsetLocal(boolean local)voidsetLong(int index, long value)Sets the specified 64-bit long integer at the specified absoluteindexin this buffer.voidsetOutputStream(OutputStream output)Sets the OutputStream of this buffer to the specified output.voidsetShort(int index, short value)Sets the specified 16-bit short integer at the specified absoluteindexin this buffer.voidsetZero(int index, int length)intskipBytes(int length)Increases the currentreaderIndexby the specifiedlengthin this buffer.ActiveMQBufferslice()Returns a slice of this buffer's readable bytes.ActiveMQBufferslice(int index, int length)Returns a slice of this buffer's sub-region.LargeMessageControllerImpl.LargeDatatake()ByteBuffertoByteBuffer()Converts this buffer's readable bytes into a NIO buffer.ByteBuffertoByteBuffer(int index, int length)Converts this buffer's sub-region into a NIO buffer.ByteBuffer[]toByteBuffers()ByteBuffer[]toByteBuffers(int index, int length)StringtoString(String charsetName)booleanwaitCompletion(long timeWait)Waits for the completion for the specified waiting time (in milliseconds).booleanwritable()intwritableBytes()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.intwriteBytes(InputStream in, int length)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.intwriteBytes(ScatteringByteChannel in, int length)voidwriteBytes(ActiveMQBuffer src)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 val)Sets the specified char at the currentwriterIndexand increases thewriterIndexby2in this buffer.voidwriteDouble(double val)Sets the specified double at the currentwriterIndexand increases thewriterIndexby8in this buffer.voidwriteFloat(float val)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.voidwriteMedium(int value)voidwriteNullableBoolean(Boolean val)Sets 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.voidwriteNullableSimpleString(SimpleString val)Sets the specified SimpleString (potentiallynull) at the currentwriterIndexvoidwriteNullableString(String val)Sets the specified String (potentiallynull) at the currentwriterIndexintwriterIndex()voidwriterIndex(int writerIndex)Sets thewriterIndexof this buffer.voidwriteShort(short value)Sets the specified 16-bit short integer at the currentwriterIndexand increases thewriterIndexby2in this buffer.voidwriteSimpleString(SimpleString val)Sets the specified non-null SimpleString at the currentwriterIndexvoidwriteString(String val)Sets the specified non-null String at the currentwriterIndexvoidwriteUTF(String utf)Sets the specified UTF-8 String at the currentwriterIndexvoidwriteZero(int length)
-
-
-
Constructor Detail
-
LargeMessageControllerImpl
public LargeMessageControllerImpl(ClientConsumerInternal consumerInternal, long totalSize, long readTimeout)
-
LargeMessageControllerImpl
public LargeMessageControllerImpl(ClientConsumerInternal consumerInternal, long totalSize, long readTimeout, File cachedFile)
-
LargeMessageControllerImpl
public LargeMessageControllerImpl(ClientConsumerInternal consumerInternal, long totalSize, long readTimeout, File cachedFile, int bufferSize)
-
-
Method Detail
-
setLocal
public void setLocal(boolean local)
-
discardUnusedPackets
public void discardUnusedPackets()
Description copied from interface:LargeMessageControllerDiscards packets unused by this buffer.- Specified by:
discardUnusedPacketsin interfaceLargeMessageController
-
addPacket
public void addPacket(byte[] chunk, int flowControlSize, boolean isContinues)TODO: move this to ConsumerContext as large message is a protocol specific thing Add a buff to the List, or save it to the OutputStream if set- Specified by:
addPacketin interfaceLargeMessageController
-
cancel
public void cancel()
Description copied from interface:LargeMessageControllerCancels this buffer.- Specified by:
cancelin interfaceLargeMessageController
-
close
public void close()
Description copied from interface:LargeMessageControllerCloses this buffer.- Specified by:
closein interfaceLargeMessageController
-
setOutputStream
public void setOutputStream(OutputStream output) throws ActiveMQException
Description copied from interface:LargeMessageControllerSets the OutputStream of this buffer to the specified output.- Specified by:
setOutputStreamin interfaceLargeMessageController- Throws:
ActiveMQException
-
saveBuffer
public void saveBuffer(OutputStream output) throws ActiveMQException
Description copied from interface:LargeMessageControllerSaves this buffer to the specified output. This is just a blocking version ofLargeMessageController.setOutputStream(OutputStream).- Specified by:
saveBufferin interfaceLargeMessageController- Throws:
ActiveMQException
-
waitCompletion
public boolean waitCompletion(long timeWait) throws ActiveMQExceptionDescription copied from interface:LargeMessageControllerWaits for the completion for the specified waiting time (in milliseconds).- Specified by:
waitCompletionin interfaceLargeMessageController- Parameters:
timeWait- Milliseconds to Wait. 0 means forever- Throws:
ActiveMQException
-
take
public LargeMessageControllerImpl.LargeData take() throws InterruptedException
- Specified by:
takein interfaceLargeMessageController- Throws:
InterruptedException
-
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.
-
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
-
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, ActiveMQBuffer 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 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
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(long index, byte[] dst, int dstIndex, int length)
-
getBytes
public void getBytes(int index, ByteBuffer dst)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
public void getBytes(long index, ByteBuffer dst)
-
getBytes
public void getBytes(int index, OutputStream out, int length) throws IOException- Throws:
IOException
-
getBytes
public void getBytes(long index, OutputStream out, int length) throws IOException- Throws:
IOException
-
getBytes
public int getBytes(int index, GatheringByteChannel out, int length) throws IOException- Throws:
IOException
-
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
-
getInt
public int getInt(long 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
-
getLong
public long getLong(long 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
-
getShort
public short getShort(long index)
-
getUnsignedMedium
public int getUnsignedMedium(long 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- Parameters:
index- Index into the buffervalue- The specified byte
-
setBytes
public void setBytes(int index, ActiveMQBuffer src, int srcIndex, int length)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
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, ByteBuffer src)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
-
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
-
toByteBuffer
public ByteBuffer toByteBuffer(int index, int length)
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
-
readerIndex
public int readerIndex()
- 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
-
writerIndex
public int writerIndex()
- Specified by:
writerIndexin interfaceActiveMQBuffer- Returns:
- the
writerIndexof this buffer.
-
getSize
public long getSize()
Description copied from interface:LargeMessageControllerReturns the size of this buffer.- Specified by:
getSizein interfaceLargeMessageController
-
writerIndex
public void writerIndex(int writerIndex)
Description copied from interface:ActiveMQBufferSets thewriterIndexof this buffer.- Specified by:
writerIndexin interfaceActiveMQBuffer- Parameters:
writerIndex- The writer's index
-
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
-
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
-
readable
public boolean readable()
- Specified by:
readablein interfaceActiveMQBuffer- Returns:
trueif and only if(this.writerIndex - this.readerIndex)is greater than0.
-
writable
public boolean writable()
- Specified by:
writablein interfaceActiveMQBuffer- Returns:
trueif and only if(this.capacity - this.writerIndex)is greater than0.
-
readableBytes
public int readableBytes()
- Specified by:
readableBytesin interfaceActiveMQBuffer- Returns:
- the number of readable bytes which is equal to
(this.writerIndex - this.readerIndex).
-
writableBytes
public int writableBytes()
- Specified by:
writableBytesin interfaceActiveMQBuffer- Returns:
- the number of writable bytes which is equal to
(this.capacity - this.writerIndex).
-
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
-
resetReaderIndex
public void resetReaderIndex()
Description copied from interface:ActiveMQBufferRepositions the currentreaderIndexto the markedreaderIndexin this buffer.- Specified by:
resetReaderIndexin 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
-
resetWriterIndex
public void resetWriterIndex()
Description copied from interface:ActiveMQBufferRepositions the currentwriterIndexto the markedwriterIndexin this buffer.- Specified by:
resetWriterIndexin interfaceActiveMQBuffer
-
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
-
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
-
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
-
getMedium
public int getMedium(int 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
-
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
public void getBytes(long index, byte[] dst)
-
getBytes
public void getBytes(int index, ActiveMQBuffer dst)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
-
getBytes
public void getBytes(int index, ActiveMQBuffer dst, int length)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
-
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
public void setBytes(int index, ActiveMQBuffer src)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
-
setBytes
public void setBytes(int index, ActiveMQBuffer src, int length)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
-
setZero
public void setZero(int index, int length)
-
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
-
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
-
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
-
readMedium
public int readMedium()
-
readUnsignedMedium
public int readUnsignedMedium()
-
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
-
readInt
public int readInt(int pos)
-
readNullableInt
public Integer 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
-
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
-
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
public Long 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
-
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
public void readBytes(ActiveMQBuffer dst)
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
-
readBytes
public void readBytes(ActiveMQBuffer dst, 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). 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
public void readBytes(ActiveMQBuffer 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 buffer indexlength- the number of bytes to transfer
-
readBytes
public void readBytes(ByteBuffer dst)
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
public int readBytes(GatheringByteChannel out, int length) throws IOException
- Throws:
IOException
-
readBytes
public void readBytes(OutputStream out, int length) throws IOException
- Throws:
IOException
-
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
-
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
-
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
-
writeMedium
public void writeMedium(int value)
-
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
public void writeNullableInt(Integer value)
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
public void writeNullableLong(Long value)
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
-
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
public void writeBytes(ActiveMQBuffer src)
-
writeBytes
public void writeBytes(ActiveMQBuffer src, int length)
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
-
writeBytes
public void writeBytes(ByteBuffer src)
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)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.- Specified by:
writeBytesin interfaceActiveMQBuffer- Parameters:
src- The source buffer- Throws:
IndexOutOfBoundsException- ifsrc.remaining()is greater thanthis.writableBytes
-
writeBytes
public int writeBytes(InputStream in, int length) throws IOException
- Throws:
IOException
-
writeBytes
public int writeBytes(ScatteringByteChannel in, int length) throws IOException
- Throws:
IOException
-
writeZero
public void writeZero(int length)
-
toByteBuffer
public ByteBuffer 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
-
toByteBuffers
public ByteBuffer[] toByteBuffers()
-
toByteBuffers
public ByteBuffer[] toByteBuffers(int index, int length)
-
getUnderlyingBuffer
public Object getUnderlyingBuffer()
-
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
public Boolean 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
-
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
-
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
-
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
-
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
-
readNullableSimpleString
public SimpleString 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
public String 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
public SimpleString 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
public String 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
-
readUTF
public 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
public void writeNullableBoolean(Boolean val)
Description copied from interface:ActiveMQBufferSets the specified (potentiallynull) Boolean at the currentwriterIndex- Specified by:
writeNullableBooleanin interfaceActiveMQBuffer- Parameters:
val- The specified boolean
-
writeChar
public void writeChar(char val)
Description copied from interface:ActiveMQBufferSets the specified char at the currentwriterIndexand increases thewriterIndexby2in this buffer.- Specified by:
writeCharin interfaceActiveMQBuffer- Parameters:
val- The specified char
-
writeDouble
public void writeDouble(double val)
Description copied from interface:ActiveMQBufferSets the specified double at the currentwriterIndexand increases thewriterIndexby8in this buffer.- Specified by:
writeDoublein interfaceActiveMQBuffer- Parameters:
val- The specified double
-
writeFloat
public void writeFloat(float val)
Description copied from interface:ActiveMQBufferSets the specified float at the currentwriterIndexand increases thewriterIndexby4in this buffer.- Specified by:
writeFloatin interfaceActiveMQBuffer- Parameters:
val- The specified float
-
writeNullableSimpleString
public void writeNullableSimpleString(SimpleString val)
Description copied from interface:ActiveMQBufferSets the specified SimpleString (potentiallynull) at the currentwriterIndex- Specified by:
writeNullableSimpleStringin interfaceActiveMQBuffer- Parameters:
val- The specified SimpleString
-
writeNullableString
public void writeNullableString(String val)
Description copied from interface:ActiveMQBufferSets the specified String (potentiallynull) at the currentwriterIndex- Specified by:
writeNullableStringin interfaceActiveMQBuffer- Parameters:
val- The specified String
-
writeSimpleString
public void writeSimpleString(SimpleString val)
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
public void writeString(String val)
Description copied from interface:ActiveMQBufferSets the specified non-null String at the currentwriterIndex- Specified by:
writeStringin interfaceActiveMQBuffer- Parameters:
val- The specified non-null String
-
writeUTF
public void writeUTF(String utf)
Description copied from interface:ActiveMQBufferSets the specified UTF-8 String at the currentwriterIndex- Specified by:
writeUTFin interfaceActiveMQBuffer- Parameters:
utf- The specified UTF-8 String
-
copy
public ActiveMQBuffer 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.
-
slice
public ActiveMQBuffer slice(int index, int length)
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.
-
readFully
public void readFully(byte[] b) throws IOExceptionfromDataInputinterface- Specified by:
readFullyin interfaceDataInput- Throws:
IOException
-
readFully
public void readFully(byte[] b, int off, int len) throws IOExceptionfromDataInputinterface- Specified by:
readFullyin interfaceDataInput- Throws:
IOException
-
readLine
public String readLine() throws IOException
fromDataInputinterface- Specified by:
readLinein interfaceDataInput- Throws:
IOException
-
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
-
copy
public ActiveMQBuffer copy(int index, int length)
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.
-
duplicate
public ActiveMQBuffer 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.
-
readSlice
public ActiveMQBuffer readSlice(int length)
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
-
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
-
slice
public ActiveMQBuffer 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
-
writeBytes
public void writeBytes(ActiveMQBuffer src, int srcIndex, int length)
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
-
-