public class ResetLimitWrappedHornetQBuffer extends ChannelBufferWrapper
buffer
Constructor and Description |
---|
ResetLimitWrappedHornetQBuffer(int limit,
HornetQBuffer buffer,
MessageInternal message) |
Modifier and Type | Method and Description |
---|---|
void |
clear()
Sets the
readerIndex and writerIndex of this buffer to
0 . |
void |
readerIndex(int readerIndex)
Sets the
readerIndex of this buffer. |
void |
resetReaderIndex()
Repositions the current
readerIndex to the marked
readerIndex in this buffer. |
void |
resetWriterIndex()
Repositions the current
writerIndex to the marked
writerIndex in this buffer. |
void |
setBuffer(HornetQBuffer buffer) |
void |
setByte(int index,
byte value)
Sets the specified byte at the specified absolute
index in this
buffer. |
void |
setBytes(int index,
byte[] src)
Transfers the specified source array's data to this buffer starting at
the specified absolute
index . |
void |
setBytes(int index,
byte[] src,
int srcIndex,
int length)
Transfers the specified source array's data to this buffer starting at
the specified absolute
index . |
void |
setBytes(int index,
ByteBuffer src)
Transfers the specified source buffer's data to this buffer starting at
the specified absolute
index until the source buffer's position
reaches its limit. |
void |
setBytes(int index,
HornetQBuffer src)
Transfers the specified source buffer's data to this buffer starting at
the specified absolute
index until the destination becomes
unreadable. |
void |
setBytes(int index,
HornetQBuffer src,
int length)
Transfers the specified source buffer's data to this buffer starting at
the specified absolute
index . |
void |
setBytes(int index,
HornetQBuffer src,
int srcIndex,
int length)
Transfers the specified source buffer's data to this buffer starting at
the specified absolute
index . |
void |
setChar(int index,
char value)
Sets the specified char at the specified absolute
index in this buffer. |
void |
setDouble(int index,
double value)
Sets the specified double at the specified absolute
index in this buffer. |
void |
setFloat(int index,
float value)
Sets the specified float at the specified absolute
index in this buffer. |
void |
setIndex(int readerIndex,
int writerIndex)
Sets the
readerIndex and writerIndex of this buffer
in one shot. |
void |
setInt(int index,
int value)
Sets the specified 32-bit integer at the specified absolute
index in this buffer. |
void |
setLong(int index,
long value)
Sets the specified 64-bit long integer at the specified absolute
index in this buffer. |
void |
setShort(int index,
short value)
Sets the specified 16-bit short integer at the specified absolute
index in this buffer. |
void |
writeBoolean(boolean val)
Sets the specified boolean at the current
writerIndex |
void |
writeByte(byte value)
Sets the specified byte at the current
writerIndex
and increases the writerIndex by 1 in this buffer. |
void |
writeBytes(byte[] src)
Transfers the specified source array's data to this buffer starting at
the current
writerIndex and increases the writerIndex
by the number of the transferred bytes (= src.length ). |
void |
writeBytes(byte[] src,
int srcIndex,
int length)
Transfers the specified source array's data to this buffer starting at
the current
writerIndex and increases the writerIndex
by the number of the transferred bytes (= length ). |
void |
writeBytes(ByteBuffer src)
Transfers the specified source buffer's data to this buffer starting at
the current
writerIndex until the source buffer's position
reaches its limit, and increases the writerIndex by the
number of the transferred bytes. |
void |
writeBytes(HornetQBuffer src,
int length)
Transfers the specified source buffer's data to this buffer starting at
the current
writerIndex and increases the writerIndex
by the number of the transferred bytes (= length ). |
void |
writeBytes(HornetQBuffer src,
int srcIndex,
int length)
Transfers the specified source buffer's data to this buffer starting at
the current
writerIndex and increases the writerIndex
by the number of the transferred bytes (= length ). |
void |
writeChar(char chr)
Sets the specified char at the current
writerIndex
and increases the writerIndex by 2 in this buffer. |
void |
writeDouble(double value)
Sets the specified double at the current
writerIndex
and increases the writerIndex by 8 in this buffer. |
void |
writeFloat(float value)
Sets the specified float at the current
writerIndex
and increases the writerIndex by 4 in this buffer. |
void |
writeInt(int value)
Sets the specified 32-bit integer at the current
writerIndex
and increases the writerIndex by 4 in this buffer. |
void |
writeLong(long value)
Sets the specified 64-bit long integer at the current
writerIndex and increases the writerIndex by 8
in this buffer. |
void |
writeNullableSimpleString(SimpleString val)
Sets the specified SimpleString (potentially
null ) at the current writerIndex |
void |
writeNullableString(String val)
Sets the specified String (potentially
null ) at the current writerIndex |
void |
writerIndex(int writerIndex)
Sets the
writerIndex of this buffer. |
void |
writeShort(short value)
Sets the specified 16-bit short integer at the current
writerIndex and increases the writerIndex by 2
in this buffer. |
void |
writeSimpleString(SimpleString val)
Sets the specified non-null SimpleString at the current
writerIndex |
void |
writeString(String val)
Sets the specified non-null String at the current
writerIndex |
void |
writeUTF(String utf)
Sets the specified UTF-8 String at the current
writerIndex |
capacity, channelBuffer, copy, copy, discardReadBytes, duplicate, getByte, getBytes, getBytes, getBytes, getBytes, getBytes, getBytes, getChar, getDouble, getFloat, getInt, getLong, getShort, getUnsignedByte, getUnsignedInt, getUnsignedShort, markReaderIndex, markWriterIndex, readable, readableBytes, readBoolean, readByte, readBytes, readBytes, readBytes, readBytes, readBytes, readBytes, readBytes, readChar, readDouble, readerIndex, readFloat, readInt, readLong, readNullableSimpleString, readNullableString, readShort, readSimpleString, readSlice, readString, readUnsignedByte, readUnsignedInt, readUnsignedShort, readUTF, skipBytes, slice, slice, toByteBuffer, toByteBuffer, writable, writableBytes, writerIndex
public ResetLimitWrappedHornetQBuffer(int limit, HornetQBuffer buffer, MessageInternal message)
public void setBuffer(HornetQBuffer buffer)
public void clear()
HornetQBuffer
readerIndex
and writerIndex
of this buffer to
0
.
This method is identical to setIndex(0, 0)
.
Please note that the behavior of this method is different
from that of NIO buffer, which sets the limit
to
the capacity
of the buffer.
clear
in interface HornetQBuffer
clear
in class ChannelBufferWrapper
public void readerIndex(int readerIndex)
HornetQBuffer
readerIndex
of this buffer.readerIndex
in interface HornetQBuffer
readerIndex
in class ChannelBufferWrapper
public void resetReaderIndex()
HornetQBuffer
readerIndex
to the marked
readerIndex
in this buffer.resetReaderIndex
in interface HornetQBuffer
resetReaderIndex
in class ChannelBufferWrapper
public void resetWriterIndex()
HornetQBuffer
writerIndex
to the marked
writerIndex
in this buffer.resetWriterIndex
in interface HornetQBuffer
resetWriterIndex
in class ChannelBufferWrapper
public void setIndex(int readerIndex, int writerIndex)
HornetQBuffer
readerIndex
and writerIndex
of this buffer
in one shot. This method is useful when you have to worry about the
invocation order of HornetQBuffer.readerIndex(int)
and HornetQBuffer.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,
HornetQBuffer.setIndex(int, int)
guarantees that it never
throws an IndexOutOfBoundsException
as 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);
setIndex
in interface HornetQBuffer
setIndex
in class ChannelBufferWrapper
public void writerIndex(int writerIndex)
HornetQBuffer
writerIndex
of this buffer.writerIndex
in interface HornetQBuffer
writerIndex
in class ChannelBufferWrapper
public void setByte(int index, byte value)
HornetQBuffer
index
in this
buffer.
This method does not modify readerIndex
or writerIndex
of
this buffer.setByte
in interface HornetQBuffer
setByte
in class ChannelBufferWrapper
public void setBytes(int index, byte[] src, int srcIndex, int length)
HornetQBuffer
index
.
This method does not modify readerIndex
or writerIndex
of
this buffer.setBytes
in interface HornetQBuffer
setBytes
in class ChannelBufferWrapper
public void setBytes(int index, byte[] src)
HornetQBuffer
index
.
This method does not modify readerIndex
or writerIndex
of
this buffer.setBytes
in interface HornetQBuffer
setBytes
in class ChannelBufferWrapper
public void setBytes(int index, ByteBuffer src)
HornetQBuffer
index
until the source buffer's position
reaches its limit.
This method does not modify readerIndex
or writerIndex
of
this buffer.setBytes
in interface HornetQBuffer
setBytes
in class ChannelBufferWrapper
public void setBytes(int index, HornetQBuffer src, int srcIndex, int length)
HornetQBuffer
index
.
This method does not modify readerIndex
or writerIndex
of both the source (i.e. this
) and the destination.setBytes
in interface HornetQBuffer
setBytes
in class ChannelBufferWrapper
srcIndex
- the first index of the sourcelength
- the number of bytes to transferpublic void setBytes(int index, HornetQBuffer src, int length)
HornetQBuffer
index
. This method is basically same
with HornetQBuffer.setBytes(int, HornetQBuffer, int, int)
, except that this
method increases the readerIndex
of the source buffer by
the number of the transferred bytes while
HornetQBuffer.getBytes(int, HornetQBuffer, int, int)
does not.
This method does not modify readerIndex
or writerIndex
of
the source buffer (i.e. this
).setBytes
in interface HornetQBuffer
setBytes
in class ChannelBufferWrapper
length
- the number of bytes to transferpublic void setBytes(int index, HornetQBuffer src)
HornetQBuffer
index
until the destination becomes
unreadable. This method is basically same with
HornetQBuffer.setBytes(int, HornetQBuffer, int, int)
, except that this
method increases the readerIndex
of the source buffer by
the number of the transferred bytes while
HornetQBuffer.getBytes(int, HornetQBuffer, int, int)
does not.
This method does not modify readerIndex
or writerIndex
of
the source buffer (i.e. this
).setBytes
in interface HornetQBuffer
setBytes
in class ChannelBufferWrapper
public void setChar(int index, char value)
HornetQBuffer
index
in this buffer.
This method does not modify readerIndex
or writerIndex
of
this buffer.setChar
in interface HornetQBuffer
setChar
in class ChannelBufferWrapper
public void setDouble(int index, double value)
HornetQBuffer
index
in this buffer.
This method does not modify readerIndex
or writerIndex
of
this buffer.setDouble
in interface HornetQBuffer
setDouble
in class ChannelBufferWrapper
public void setFloat(int index, float value)
HornetQBuffer
index
in this buffer.
This method does not modify readerIndex
or writerIndex
of
this buffer.setFloat
in interface HornetQBuffer
setFloat
in class ChannelBufferWrapper
public void setInt(int index, int value)
HornetQBuffer
index
in this buffer.
This method does not modify readerIndex
or writerIndex
of
this buffer.setInt
in interface HornetQBuffer
setInt
in class ChannelBufferWrapper
public void setLong(int index, long value)
HornetQBuffer
index
in this buffer.
This method does not modify readerIndex
or writerIndex
of
this buffer.setLong
in interface HornetQBuffer
setLong
in class ChannelBufferWrapper
public void setShort(int index, short value)
HornetQBuffer
index
in this buffer.
This method does not modify readerIndex
or writerIndex
of
this buffer.setShort
in interface HornetQBuffer
setShort
in class ChannelBufferWrapper
public void writeBoolean(boolean val)
HornetQBuffer
writerIndex
writeBoolean
in interface HornetQBuffer
writeBoolean
in class ChannelBufferWrapper
public void writeByte(byte value)
HornetQBuffer
writerIndex
and increases the writerIndex
by 1
in this buffer.writeByte
in interface HornetQBuffer
writeByte
in class ChannelBufferWrapper
public void writeBytes(byte[] src, int srcIndex, int length)
HornetQBuffer
writerIndex
and increases the writerIndex
by the number of the transferred bytes (= length
).writeBytes
in interface HornetQBuffer
writeBytes
in class ChannelBufferWrapper
srcIndex
- the first index of the sourcelength
- the number of bytes to transferpublic void writeBytes(byte[] src)
HornetQBuffer
writerIndex
and increases the writerIndex
by the number of the transferred bytes (= src.length
).writeBytes
in interface HornetQBuffer
writeBytes
in class ChannelBufferWrapper
public void writeBytes(ByteBuffer src)
HornetQBuffer
writerIndex
until the source buffer's position
reaches its limit, and increases the writerIndex
by the
number of the transferred bytes.writeBytes
in interface HornetQBuffer
writeBytes
in class ChannelBufferWrapper
public void writeBytes(HornetQBuffer src, int srcIndex, int length)
HornetQBuffer
writerIndex
and increases the writerIndex
by the number of the transferred bytes (= length
).writeBytes
in interface HornetQBuffer
writeBytes
in class ChannelBufferWrapper
srcIndex
- the first index of the sourcelength
- the number of bytes to transferpublic void writeBytes(HornetQBuffer src, int length)
HornetQBuffer
writerIndex
and increases the writerIndex
by the number of the transferred bytes (= length
). This method
is basically same with HornetQBuffer.writeBytes(HornetQBuffer, int, int)
,
except that this method increases the readerIndex
of the source
buffer by the number of the transferred bytes (= length
) while
HornetQBuffer.writeBytes(HornetQBuffer, int, int)
does not.writeBytes
in interface HornetQBuffer
writeBytes
in class ChannelBufferWrapper
length
- the number of bytes to transferpublic void writeChar(char chr)
HornetQBuffer
writerIndex
and increases the writerIndex
by 2
in this buffer.writeChar
in interface HornetQBuffer
writeChar
in class ChannelBufferWrapper
public void writeDouble(double value)
HornetQBuffer
writerIndex
and increases the writerIndex
by 8
in this buffer.writeDouble
in interface HornetQBuffer
writeDouble
in class ChannelBufferWrapper
public void writeFloat(float value)
HornetQBuffer
writerIndex
and increases the writerIndex
by 4
in this buffer.writeFloat
in interface HornetQBuffer
writeFloat
in class ChannelBufferWrapper
public void writeInt(int value)
HornetQBuffer
writerIndex
and increases the writerIndex
by 4
in this buffer.writeInt
in interface HornetQBuffer
writeInt
in class ChannelBufferWrapper
public void writeLong(long value)
HornetQBuffer
writerIndex
and increases the writerIndex
by 8
in this buffer.writeLong
in interface HornetQBuffer
writeLong
in class ChannelBufferWrapper
public void writeNullableSimpleString(SimpleString val)
HornetQBuffer
null
) at the current writerIndex
writeNullableSimpleString
in interface HornetQBuffer
writeNullableSimpleString
in class ChannelBufferWrapper
public void writeNullableString(String val)
HornetQBuffer
null
) at the current writerIndex
writeNullableString
in interface HornetQBuffer
writeNullableString
in class ChannelBufferWrapper
public void writeShort(short value)
HornetQBuffer
writerIndex
and increases the writerIndex
by 2
in this buffer.writeShort
in interface HornetQBuffer
writeShort
in class ChannelBufferWrapper
public void writeSimpleString(SimpleString val)
HornetQBuffer
writerIndex
writeSimpleString
in interface HornetQBuffer
writeSimpleString
in class ChannelBufferWrapper
public void writeString(String val)
HornetQBuffer
writerIndex
writeString
in interface HornetQBuffer
writeString
in class ChannelBufferWrapper
public void writeUTF(String utf)
HornetQBuffer
writerIndex
writeUTF
in interface HornetQBuffer
writeUTF
in class ChannelBufferWrapper
Copyright © 2012 JBoss by Red Hat. All Rights Reserved.