getShortLE , getIntLE代替。
@Deprecated public class SwappedByteBuf extends ByteBuf
ByteOrder的ByteBuf 。
| Constructor and Description |
|---|
SwappedByteBuf(ByteBuf buf)
已过时。
|
| Modifier and Type | Method and Description |
|---|---|
ByteBufAllocator |
alloc()
已过时。
返回创建此缓冲区的 ByteBufAllocator 。
|
byte[] |
array()
已过时。
返回此缓冲区的后备字节数组。
|
int |
arrayOffset()
已过时。
返回此缓冲区的后备字节数组中第一个字节的偏移量。
|
ByteBuf |
asReadOnly()
已过时。
返回此缓冲区的只读版本。
|
int |
bytesBefore(byte value)
已过时。
定位此缓冲区中第一次出现的指定
value 。
|
int |
bytesBefore(int length, byte value)
已过时。
定位此缓冲区中第一次出现的指定
value 。
|
int |
bytesBefore(int index, int length, byte value)
已过时。
定位此缓冲区中第一次出现的指定
value 。
|
int |
capacity()
已过时。
返回此缓冲区可包含的字节数(字节)。
|
ByteBuf |
capacity(int newCapacity)
已过时。
调整此缓冲区的容量。
|
ByteBuf |
clear()
已过时。
将此缓冲区的
readerIndex和
writerIndex设置为
0 。
|
int |
compareTo(ByteBuf buffer)
已过时。
将指定缓冲区的内容与此缓冲区的内容进行比较。
|
ByteBuf |
copy()
已过时。
返回此缓冲区可读字节的副本。
|
ByteBuf |
copy(int index, int length)
已过时。
返回此缓冲区的子区域的副本。
|
ByteBuf |
discardReadBytes()
已过时。
丢弃第0个索引和
readerIndex之间的字节。
|
ByteBuf |
discardSomeReadBytes()
已过时。
类似于
ByteBuf.discardReadBytes(),只是此方法可能会丢弃部分,全部或者全部读取字节,具体取决于其内部实现方式,以减少潜在的额外内存消耗为代价降低整体内存带宽消耗。
|
ByteBuf |
duplicate()
已过时。
返回共享此缓冲区整个区域的缓冲区。
|
ByteBuf |
ensureWritable(int writableBytes)
已过时。
确保
the writable bytes的数量等于或大于指定的值。
|
int |
ensureWritable(int minWritableBytes, boolean force)
已过时。
尝试确保
the writable bytes的数量等于或大于指定值。
|
boolean |
equals(java.lang.Object obj)
已过时。
确定指定缓冲区的内容是否与此数组的内容相同。
|
int |
forEachByte(ByteProcessor processor)
已过时。
以指定的
processor按升序迭代此缓冲区的可读字节。
|
int |
forEachByte(int index, int length, ByteProcessor processor)
已过时。
以指定的
processor按升序迭代该缓冲区的指定区域。
|
int |
forEachByteDesc(ByteProcessor processor)
已过时。
使用指定的
processor按降序对此缓冲区的可读字节进行迭代。
|
int |
forEachByteDesc(int index, int length, ByteProcessor processor)
已过时。
以指定的
processor降序遍历此缓冲区的指定区域。
|
boolean |
getBoolean(int index)
已过时。
在此缓冲区中获取指定绝对(@code索引)的布尔值。
|
byte |
getByte(int index)
已过时。
在此缓冲区中的指定绝对
index处获取一个字节。
|
ByteBuf |
getBytes(int index, byte[] dst)
已过时。
将此缓冲区的数据传输到指定的绝对
index开始的目标。
|
ByteBuf |
getBytes(int index, byte[] dst, int dstIndex, int length)
已过时。
将此缓冲区的数据传输到指定的目标,从指定的绝对
index 。
|
ByteBuf |
getBytes(int index, ByteBuf dst)
已过时。
将此缓冲区的数据传输到指定的目的地,从指定的绝对
index开始,直到目标变为不可写。
|
ByteBuf |
getBytes(int index, java.nio.ByteBuffer dst)
已过时。
将此缓冲区的数据传输到指定的目标位置,从指定的绝对
index开始,直到目标位置达到其限制。
|
ByteBuf |
getBytes(int index, ByteBuf dst, int length)
已过时。
将此缓冲区的数据传输到指定的目标,从指定的绝对
index 。
|
ByteBuf |
getBytes(int index, ByteBuf dst, int dstIndex, int length)
已过时。
将此缓冲区的数据传输到指定的绝对目标
index开始的目标。
|
int |
getBytes(int index, java.nio.channels.FileChannel out, long position, int length)
已过时。
将此缓冲区的数据从指定的绝对
index到指定的通道,从给定的文件位置开始。
|
int |
getBytes(int index, java.nio.channels.GatheringByteChannel out, int length)
已过时。
将此缓冲区的数据传输到指定的通道,从指定的绝对
index 。
|
ByteBuf |
getBytes(int index, java.io.OutputStream out, int length)
已过时。
将此缓冲区的数据传输到指定的流,从指定的绝对
index 。
|
char |
getChar(int index)
已过时。
在此缓冲区中指定的绝对
index处获取一个2字节的UTF-16字符。
|
java.lang.CharSequence |
getCharSequence(int index, int length, java.nio.charset.Charset charset)
已过时。
在给定索引处获取具有给定长度的
CharSequence 。
|
double |
getDouble(int index)
已过时。
在此缓冲区中的指定绝对
index处获取一个64位浮点数。
|
float |
getFloat(int index)
已过时。
在此缓冲区中的指定绝对
index处获取一个32位浮点数。
|
int |
getInt(int index)
已过时。
在此缓冲区中指定的绝对
index处获取一个32位整数。
|
int |
getIntLE(int index)
已过时。
在具有Little Endian Byte Order的缓冲区中的指定绝对
index处获取一个32位整数。
|
long |
getLong(int index)
已过时。
在此缓冲区中指定的绝对
index处获取一个64位长整数。
|
long |
getLongLE(int index)
已过时。
以小端字节顺序在此缓冲区中的指定绝对
index处获取64位长整数。
|
int |
getMedium(int index)
已过时。
在此缓冲区中的指定绝对
index处获取一个24位中等整数。
|
int |
getMediumLE(int index)
已过时。
以小端字节顺序在此缓冲区中的指定绝对
index处获取一个24位中等整数。
|
short |
getShort(int index)
已过时。
在此缓冲区中的指定绝对
index处获取一个16位短整数。
|
short |
getShortLE(int index)
已过时。
以Little Endian字节顺序在此缓冲区中的指定绝对
index处获取一个16位短整数。
|
short |
getUnsignedByte(int index)
已过时。
在此缓冲区中的指定绝对
index处获取一个无符号字节。
|
long |
getUnsignedInt(int index)
已过时。
在此缓冲区中指定的绝对
index处获取一个无符号的32位整数。
|
long |
getUnsignedIntLE(int index)
已过时。
以小端字节顺序在此缓冲区中的指定绝对
index处获取无符号的32位整数。
|
int |
getUnsignedMedium(int index)
已过时。
在此缓冲区中指定的绝对
index处获取一个无符号的24位中等整数。
|
int |
getUnsignedMediumLE(int index)
已过时。
以Little Endian Byte Order的形式获取缓冲区中指定绝对
index的无符号24位中等整数。
|
int |
getUnsignedShort(int index)
已过时。
在此缓冲区中的指定绝对
index处获取一个无符号的16位短整数。
|
int |
getUnsignedShortLE(int index)
已过时。
以小端字节顺序在此缓冲区中的指定绝对
index处获取一个无符号的16位短整数。
|
boolean |
hasArray()
已过时。
当且仅当此缓冲区有一个后备字节数组时返回
true 。
|
int |
hashCode()
已过时。
返回从此缓冲区的内容计算出来的哈希码。
|
boolean |
hasMemoryAddress()
已过时。
当且仅当此缓冲区引用指向后备数据的低级内存地址时才返回
true 。
|
int |
indexOf(int fromIndex, int toIndex, byte value)
已过时。
定位此缓冲区中第一次出现的指定
value 。
|
java.nio.ByteBuffer |
internalNioBuffer(int index, int length)
已过时。
仅内部使用:公开内部NIO缓冲区。
|
boolean |
isDirect()
已过时。
当且仅当此缓冲区由NIO直接缓冲区支持时才返回
true 。
|
boolean |
isReadable()
已过时。
返回
true当且仅当
(this.writerIndex - this.readerIndex)大于
0 。
|
boolean |
isReadable(int size)
已过时。
当且仅当此缓冲区包含等于或多于指定数量的元素时返回
true 。
|
boolean |
isReadOnly()
已过时。
当且仅当此缓冲区为只读时才返回
true 。
|
boolean |
isWritable()
已过时。
返回
true当且仅当
(this.capacity - this.writerIndex)大于
0 。
|
boolean |
isWritable(int size)
已过时。
当且仅当此缓冲区有足够空间允许写入指定数量的元素时才返回
true 。
|
ByteBuf |
markReaderIndex()
已过时。
在此缓冲区中标记当前的
readerIndex 。
|
ByteBuf |
markWriterIndex()
已过时。
在此缓冲区中标记当前的
writerIndex 。
|
int |
maxCapacity()
已过时。
返回此缓冲区允许的最大容量。
|
int |
maxWritableBytes()
已过时。
返回可写入的最大字节数,等于
(this.maxCapacity - this.writerIndex) 。
|
long |
memoryAddress()
已过时。
返回指向备份数据第一个字节的低级内存地址。
|
java.nio.ByteBuffer |
nioBuffer()
已过时。
以NIO
ByteBuffer公开此缓冲区的可读字节。
|
java.nio.ByteBuffer |
nioBuffer(int index, int length)
已过时。
将此缓冲区的子区域公开为NIO
ByteBuffer 。
|
int |
nioBufferCount()
已过时。
返回由此缓冲区组成的NIO
ByteBuffer的最大数量。
|
java.nio.ByteBuffer[] |
nioBuffers()
已过时。
以NIO
ByteBuffer的形式公开此缓冲区的可读字节。
|
java.nio.ByteBuffer[] |
nioBuffers(int index, int length)
已过时。
以指定的索引和长度公开此缓冲区的字节为NIO
ByteBuffer返回的缓冲区共享或包含此缓冲区的复制内容,同时更改返回的NIO缓冲区的位置和限制不会影响此索引和标记缓冲。
|
java.nio.ByteOrder |
order()
已过时。
返回此缓冲区的
endianness 。
|
ByteBuf |
order(java.nio.ByteOrder endianness)
已过时。
返回指定
endianness的缓冲区,该缓冲区共享此缓冲区的整个区域,索引和标记。
|
int |
readableBytes()
已过时。
返回等于
(this.writerIndex - this.readerIndex)的可读字节数。
|
boolean |
readBoolean()
已过时。
在当前的
readerIndex处获取布尔值,并在此缓冲区
readerIndex
1增加
readerIndex 。
|
byte |
readByte()
已过时。
在当前的
readerIndex处获取一个字节,并在此缓冲区
readerIndex
1增加
readerIndex 。
|
ByteBuf |
readBytes(byte[] dst)
已过时。
传输此缓冲区的数据到指定的目标并从当前
readerIndex并增加了
readerIndex由传输的字节(=数量
dst.length )。
|
ByteBuf |
readBytes(byte[] dst, int dstIndex, int length)
已过时。
传输此缓冲区的数据到指定的目标并从当前
readerIndex并增加了
readerIndex由传输的字节(=数量
length )。
|
ByteBuf |
readBytes(ByteBuf dst)
已过时。
将此缓冲区的数据传输到指定的目标,从当前的
readerIndex开始,直到目标变为不可写入,并将传输的字节数增加
readerIndex 。
|
ByteBuf |
readBytes(java.nio.ByteBuffer dst)
已过时。
将此缓冲区的数据传输到从当前
readerIndex开始的指定目标,直到目标位置达到其限制,并将传输字节数增加
readerIndex 。
|
ByteBuf |
readBytes(ByteBuf dst, int length)
已过时。
传输此缓冲区的数据到指定的目标并从当前
readerIndex并增加了
readerIndex由传输的字节(=数量
length )。
|
ByteBuf |
readBytes(ByteBuf dst, int dstIndex, int length)
已过时。
传输此缓冲区的数据到指定的目标并从当前
readerIndex并增加了
readerIndex由传输的字节(=数量
length )。
|
int |
readBytes(java.nio.channels.FileChannel out, long position, int length)
已过时。
将此缓冲区的数据从当前的
readerIndex到指定通道,从给定的文件位置开始。
|
int |
readBytes(java.nio.channels.GatheringByteChannel out, int length)
已过时。
将此缓冲区的数据传输到从当前
readerIndex开始的指定流。
|
ByteBuf |
readBytes(int length)
已过时。
传输此缓冲区的数据到一个新创建的缓冲器并从当前
readerIndex并增加了
readerIndex由传输的字节(=数量
length )。
|
ByteBuf |
readBytes(java.io.OutputStream out, int length)
已过时。
将此缓冲区的数据从当前的
readerIndex开始传输到指定的流。
|
char |
readChar()
已过时。
在当前的
readerIndex处获取一个2字节的UTF-16字符,并在此缓冲区
readerIndex
2增加
readerIndex 。
|
java.lang.CharSequence |
readCharSequence(int length, java.nio.charset.Charset charset)
已过时。
在当前
readerIndex处获得具有给定长度的
CharSequence ,并将给定长度增加
readerIndex 。
|
double |
readDouble()
已过时。
在当前的
readerIndex处获取一个64位浮点数,并在此缓冲区
readerIndex
8增加
readerIndex 。
|
int |
readerIndex()
已过时。
返回此缓冲区的
readerIndex 。
|
ByteBuf |
readerIndex(int readerIndex)
已过时。
设置此缓冲区的
readerIndex 。
|
float |
readFloat()
已过时。
在当前的
readerIndex处获得一个32位浮点数,并在此缓冲区
readerIndex
4增加
readerIndex 。
|
int |
readInt()
已过时。
在当前的
readerIndex处获取32位整数,并在此缓冲区
readerIndex
4增加
readerIndex 。
|
int |
readIntLE()
已过时。
在Little Endian Byte Order中获取当前
readerIndex的32位整数,并在此缓冲区
readerIndex
4增加
readerIndex 。
|
long |
readLong()
已过时。
在当前的
readerIndex处获取64位整数,并在此缓冲区
readerIndex
8增加
readerIndex 。
|
long |
readLongLE()
已过时。
在Little Endian字节顺序的当前
readerIndex处获取一个64位整数,并在此缓冲区
readerIndex
8增加
readerIndex 。
|
int |
readMedium()
已过时。
在当前的
readerIndex处获取24位中等整数,并在此缓冲区
readerIndex
3增加
readerIndex 。
|
int |
readMediumLE()
已过时。
在Little Endian字节顺序的当前
readerIndex处获取24位中等整数,并在此缓冲区
readerIndex
3增加
readerIndex 。
|
ByteBuf |
readRetainedSlice(int length)
已过时。
返回此缓冲区的子区域并从当前的一个新的保留切片
readerIndex并增加了
readerIndex由新的切片(=大小
length )。
|
short |
readShort()
已过时。
在当前的
readerIndex处获取16位短整数,并在此缓冲区
readerIndex
2增加
readerIndex 。
|
short |
readShortLE()
已过时。
在当前
readerIndex Little Endian字节顺序获取一个16位短整数,并在此缓冲区
readerIndex
2增加
readerIndex 。
|
ByteBuf |
readSlice(int length)
已过时。
返回此缓冲区的子区域并从当前的新的片
readerIndex并增加了
readerIndex由新的切片(=大小
length )。
|
short |
readUnsignedByte()
已过时。
获取当前
readerIndex的无符号字节,并在此缓冲区
readerIndex
1增加
readerIndex 。
|
long |
readUnsignedInt()
已过时。
在当前的
readerIndex处获取一个无符号的32位整数,并在此缓冲区
readerIndex
4增加
readerIndex 。
|
long |
readUnsignedIntLE()
已过时。
在Little Endian Byte Order中获取当前
readerIndex的无符号32位整数,并在此缓冲区
readerIndex
4增加
readerIndex 。
|
int |
readUnsignedMedium()
已过时。
获取当前无符号的24位整数介质
readerIndex并增加了
readerIndex通过
3在该缓冲液。
|
int |
readUnsignedMediumLE()
已过时。
获取当前无符号的24位整数介质
readerIndex在Little Endian字节序,并增加了
readerIndex通过
3在该缓冲液。
|
int |
readUnsignedShort()
已过时。
获取当前的16位无符号短整型
readerIndex并增加了
readerIndex通过
2在该缓冲液。
|
int |
readUnsignedShortLE()
已过时。
在Little Endian字节顺序的当前
readerIndex处获取一个无符号的16位短整数,并在此缓冲区
readerIndex
2增加
readerIndex 。
|
int |
refCnt()
已过时。
返回此对象的引用计数。
|
boolean |
release()
已过时。
通过减小引用计数
1并且如果所述引用计数达到在将释放该对象
0 。
|
boolean |
release(int decrement)
已过时。
减小由指定的引用计数
decrement并且如果所述引用计数达到在将释放该对象
0 。
|
ByteBuf |
resetReaderIndex()
已过时。
将当前的
readerIndex重新定位到此缓冲区中标记为
readerIndex 。
|
ByteBuf |
resetWriterIndex()
已过时。
将当前
writerIndex重新定位到此缓冲区中标记为
writerIndex 。
|
ByteBuf |
retain()
已过时。
将引用计数增加
1 。
|
ByteBuf |
retain(int increment)
已过时。
按指定的
increment增加参考计数。
|
ByteBuf |
retainedDuplicate()
已过时。
返回共享此缓冲区整个区域的保留缓冲区。
|
ByteBuf |
retainedSlice()
已过时。
返回此缓冲区可读字节的保留片段。
|
ByteBuf |
retainedSlice(int index, int length)
已过时。
返回此缓冲区的子区域的保留切片。
|
ByteBuf |
setBoolean(int index, boolean value)
已过时。
在此缓冲区中的指定绝对
index处设置指定的布尔值。
|
ByteBuf |
setByte(int index, int value)
已过时。
在此缓冲区中的指定绝对
index处设置指定的字节。
|
ByteBuf |
setBytes(int index, byte[] src)
已过时。
将指定的源数组的数据传输到此缓冲区,从指定的绝对
index 。
|
ByteBuf |
setBytes(int index, byte[] src, int srcIndex, int length)
已过时。
将指定的源数组的数据传输到此缓冲区,从指定的绝对
index 。
|
ByteBuf |
setBytes(int index, ByteBuf src)
已过时。
将指定的源缓冲区的数据传输到此缓冲区,从指定的绝对
index开始,直到源缓冲区变得不可读。
|
ByteBuf |
setBytes(int index, java.nio.ByteBuffer src)
已过时。
将指定的源缓冲区的数据从指定的绝对
index开始传输到此缓冲区,直到源缓冲区的位置达到其限制。
|
ByteBuf |
setBytes(int index, ByteBuf src, int length)
已过时。
将指定的源缓冲区的数据从指定的绝对
index开始传送到此缓冲区。
|
ByteBuf |
setBytes(int index, ByteBuf src, int srcIndex, int length)
已过时。
将指定的源缓冲区的数据从指定的绝对
index开始传送到此缓冲区。
|
int |
setBytes(int index, java.nio.channels.FileChannel in, long position, int length)
已过时。
将从给定文件位置开始的指定源通道的内容传输到此缓冲区,从指定绝对
index 。
|
int |
setBytes(int index, java.io.InputStream in, int length)
已过时。
将指定源流的内容从指定绝对
index开始传输到此缓冲区。
|
int |
setBytes(int index, java.nio.channels.ScatteringByteChannel in, int length)
已过时。
将指定源通道的内容从指定绝对
index开始传输到此缓冲区。
|
ByteBuf |
setChar(int index, int value)
已过时。
在此缓冲区中的指定绝对
index处设置指定的2字节UTF-16字符。
|
int |
setCharSequence(int index, java.lang.CharSequence sequence, java.nio.charset.Charset charset)
已过时。
将指定
CharSequence在当前
writerIndex并增加了
writerIndex由写入的字节。
|
ByteBuf |
setDouble(int index, double value)
已过时。
在此缓冲区中的指定绝对
index处设置指定的64位浮点数。
|
ByteBuf |
setFloat(int index, float value)
已过时。
在此缓冲区中的指定绝对
index处设置指定的32位浮点数。
|
ByteBuf |
setIndex(int readerIndex, int writerIndex)
已过时。
readerIndex设置此缓冲区的
readerIndex和
writerIndex 。
|
ByteBuf |
setInt(int index, int value)
已过时。
在此缓冲区中的指定绝对
index处设置指定的32位整数。
|
ByteBuf |
setIntLE(int index, int value)
已过时。
以小端字节顺序在此缓冲区中的指定绝对
index处设置指定的32位整数。
|
ByteBuf |
setLong(int index, long value)
已过时。
在此缓冲区中的指定绝对
index处设置指定的64位长整数。
|
ByteBuf |
setLongLE(int index, long value)
已过时。
以小端字节顺序在此缓冲区中的指定绝对
index处设置指定的64位长整数。
|
ByteBuf |
setMedium(int index, int value)
已过时。
在此缓冲区中的指定绝对
index处设置指定的24位中等整数。
|
ByteBuf |
setMediumLE(int index, int value)
已过时。
以Little Endian字节顺序在此缓冲区中的指定绝对
index处设置指定的24位中等整数。
|
ByteBuf |
setShort(int index, int value)
已过时。
在此缓冲区中的指定绝对
index处设置指定的16位短整数。
|
ByteBuf |
setShortLE(int index, int value)
已过时。
在此缓冲区中的指定绝对
index使用Little Endian Byte Order设置指定的16位短整数。
|
ByteBuf |
setZero(int index, int length)
已过时。
以
NUL (0x00)填充此缓冲区,从指定的绝对
index 。
|
ByteBuf |
skipBytes(int length)
已过时。
在此缓冲区中,指定的
length增加当前
readerIndex 。
|
ByteBuf |
slice()
已过时。
返回此缓冲区可读字节的一部分。
|
ByteBuf |
slice(int index, int length)
已过时。
返回此缓冲区的子区域的一部分。
|
java.lang.String |
toString()
已过时。
返回此缓冲区的字符串表示形式。
|
java.lang.String |
toString(java.nio.charset.Charset charset)
已过时。
将此缓冲区的可读字节解码为具有指定字符集名称的字符串。
|
java.lang.String |
toString(int index, int length, java.nio.charset.Charset charset)
已过时。
将此缓冲区的子区域解码为具有指定字符集的字符串。
|
ByteBuf |
touch()
已过时。
记录此对象的当前访问位置以进行调试。
|
ByteBuf |
touch(java.lang.Object hint)
已过时。
记录此对象的当前访问位置,并附加一些用于调试的任意信息。
|
ByteBuf |
unwrap()
已过时。
如果此缓冲区是另一个缓冲区的包装,则返回底层缓冲区实例。
|
int |
writableBytes()
已过时。
返回等于
(this.capacity - this.writerIndex)的可写入字节数。
|
ByteBuf |
writeBoolean(boolean value)
已过时。
在当前的
writerIndex处设置指定的布尔值,并在此缓冲区
writerIndex
1增加
writerIndex 。
|
ByteBuf |
writeByte(int value)
已过时。
在当前的
writerIndex处设置指定的字节,并在此缓冲区
writerIndex
1增加
writerIndex 。
|
ByteBuf |
writeBytes(byte[] src)
已过时。
指定的源阵列的数据传送到该缓冲液并从当前
writerIndex并增加了
writerIndex由传输的字节(=数量
src.length )。
|
ByteBuf |
writeBytes(byte[] src, int srcIndex, int length)
已过时。
指定的源阵列的数据传送到该缓冲液并从当前
writerIndex并增加了
writerIndex由传输的字节(=数量
length )。
|
ByteBuf |
writeBytes(ByteBuf src)
已过时。
将指定源缓冲区的数据传输到此缓冲区,从当前的
writerIndex开始,直到源缓冲区变得不可读,并将传输字节数增加
writerIndex 。
|
ByteBuf |
writeBytes(java.nio.ByteBuffer src)
已过时。
将指定的源缓冲区的数据从当前的
writerIndex开始传送到此缓冲区,直到源缓冲区的位置达到其限制,并将传送的字节数增加
writerIndex 。
|
ByteBuf |
writeBytes(ByteBuf src, int length)
已过时。
指定的源缓冲区的数据传送到该缓冲液并从当前
writerIndex并增加了
writerIndex由传输的字节(=数量
length )。
|
ByteBuf |
writeBytes(ByteBuf src, int srcIndex, int length)
已过时。
指定的源缓冲区的数据传送到该缓冲液并从当前
writerIndex并增加了
writerIndex由传输的字节(=数量
length )。
|
int |
writeBytes(java.nio.channels.FileChannel in, long position, int length)
已过时。
将从给定文件位置开始的指定通道的内容传输到此缓冲区,从当前的
writerIndex开始,并将传输字节数增加
writerIndex 。
|
int |
writeBytes(java.io.InputStream in, int length)
已过时。
将指定流的内容从当前的
writerIndex开始传送到此缓冲区,并通过传送的字节数增加
writerIndex 。
|
int |
writeBytes(java.nio.channels.ScatteringByteChannel in, int length)
已过时。
将指定通道的内容从当前的
writerIndex开始传送到此缓冲区,并将传送的字节数增加到
writerIndex 。
|
ByteBuf |
writeChar(int value)
已过时。
在当前的
writerIndex处设置指定的2字节UTF-16字符,并在此缓冲区
writerIndex
2增加
writerIndex 。
|
int |
writeCharSequence(java.lang.CharSequence sequence, java.nio.charset.Charset charset)
已过时。
将指定
CharSequence在当前
writerIndex并增加了
writerIndex由写入的字节。
|
ByteBuf |
writeDouble(double value)
已过时。
在当前的
writerIndex处设置指定的64位浮点数,并在此缓冲区
writerIndex
8增加
writerIndex 。
|
ByteBuf |
writeFloat(float value)
已过时。
在当前的
writerIndex处设置指定的32位浮点数,并在此缓冲区
writerIndex
4增加
writerIndex 。
|
ByteBuf |
writeInt(int value)
已过时。
在当前的
writerIndex处设置指定的32位整数,并在此缓冲区
writerIndex
4增加
writerIndex 。
|
ByteBuf |
writeIntLE(int value)
已过时。
以小端字节顺序在当前
writerIndex处设置指定的32位整数,并在该缓冲区
writerIndex
4增加
writerIndex 。
|
ByteBuf |
writeLong(long value)
已过时。
在当前的
writerIndex处设置指定的64位长整数,并在此缓冲区
writerIndex
8增加
writerIndex 。
|
ByteBuf |
writeLongLE(long value)
已过时。
以小端字节顺序在当前
writerIndex处设置指定的64位长整数,并在此缓冲区
writerIndex
8增加
writerIndex 。
|
ByteBuf |
writeMedium(int value)
已过时。
设置在当前指定的24位整数介质
writerIndex并增加了
writerIndex通过
3在该缓冲液。
|
ByteBuf |
writeMediumLE(int value)
已过时。
以小端字节顺序在当前
writerIndex中设置指定的24位中等整数,并在此缓冲区中增加
writerIndex
3 。
|
int |
writerIndex()
已过时。
返回此缓冲区的
writerIndex 。
|
ByteBuf |
writerIndex(int writerIndex)
已过时。
设置此缓冲区的
writerIndex 。
|
ByteBuf |
writeShort(int value)
已过时。
在当前的
writerIndex处设置指定的16位短整数,并在此缓冲区
writerIndex
2增加
writerIndex 。
|
ByteBuf |
writeShortLE(int value)
已过时。
在当前的
writerIndex处设置Little Endian Byte Order中指定的16位短整数,并在此缓冲区
writerIndex
2增加
writerIndex 。
|
ByteBuf |
writeZero(int length)
已过时。
用
NUL (0x00)从当前的
writerIndex开始填充此缓冲区,
并将
writerIndex增加
writerIndex指定的
length 。
|
getDoubleLE, getFloatLE, readDoubleLE, readFloatLE, setDoubleLE, setFloatLE, writeDoubleLE, writeFloatLEpublic SwappedByteBuf(ByteBuf buf)
public java.nio.ByteOrder order()
ByteBuf
public ByteBuf order(java.nio.ByteOrder endianness)
ByteBuf
endianness的缓冲区,该缓冲区共享此缓冲区的整个区域,索引和标记。
修改返回的缓冲区或此缓冲区的内容,索引或标记会影响彼此的内容,索引和标记。
如果指定的endianness与此缓冲区的字节顺序相同,则此方法可返回this 。
此方法不会修改此缓冲区的readerIndex或writerIndex 。
public ByteBufAllocator alloc()
ByteBuf
ByteBufAllocator 。
public int capacity()
ByteBuf
public ByteBuf capacity(int newCapacity)
ByteBuf
newCapacity小于当前容量,则此缓冲区的内容将被截断。
如果newCapacity大于当前容量,则缓冲区会附加长度为(newCapacity - currentCapacity)未指定数据。
public int maxCapacity()
ByteBuf
ByteBuf.capacity(int)或ByteBuf.ensureWritable(int)将此缓冲区的容量增加到最大容量以外 ,那么这些方法将引发IllegalArgumentException 。
maxCapacity
ByteBuf
public boolean isReadOnly()
ByteBuf
true 。
isReadOnly在课堂上
ByteBuf
public ByteBuf asReadOnly()
ByteBuf
asReadOnly在课堂上
ByteBuf
public boolean isDirect()
ByteBuf
true 。
public int readerIndex()
ByteBuf
readerIndex 。
readerIndex
ByteBuf
public ByteBuf readerIndex(int readerIndex)
ByteBuf
readerIndex 。
readerIndex在课堂上
ByteBuf
public int writerIndex()
ByteBuf
writerIndex 。
writerIndex
ByteBuf
public ByteBuf writerIndex(int writerIndex)
ByteBuf
writerIndex 。
writerIndex在课堂上
ByteBuf
public ByteBuf setIndex(int readerIndex, int writerIndex)
ByteBuf
readerIndex设置此缓冲区的readerIndex和writerIndex 。
当您不得不担心ByteBuf.readerIndex(int)和ByteBuf.writerIndex(int)方法的调用顺序时,此方法非常有用。
例如,以下代码将失败:
// Create a buffer whose readerIndex, writerIndex and capacity are
// 0, 0 and 8 respectively.
ByteBuf buf = Unpooled.buffer(8);
// IndexOutOfBoundsException is thrown because the specified
// readerIndex (2) cannot be greater than the current writerIndex (0).
buf.readerIndex(2);
buf.writerIndex(4);
以下代码也将失败:
// Create a buffer whose readerIndex, writerIndex and capacity are
// 0, 8 and 8 respectively.
ByteBuf buf = Unpooled.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);
相比之下,只要指定的索引满足基本约束,该方法就保证它不会抛出IndexOutOfBoundsException ,无论缓冲区的当前索引值是什么:
// 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);
public int readableBytes()
ByteBuf
(this.writerIndex - this.readerIndex)的可读字节数。
readableBytes在课堂上
ByteBuf
public int writableBytes()
ByteBuf
(this.capacity - this.writerIndex)的可写字节数。
writableBytes
ByteBuf
public int maxWritableBytes()
ByteBuf
(this.maxCapacity - this.writerIndex) 。
maxWritableBytes在课堂上
ByteBuf
public boolean isReadable()
ByteBuf
true当且仅当
(this.writerIndex - this.readerIndex)大于
0 。
isReadable在课程
ByteBuf
public boolean isReadable(int size)
ByteBuf
true 。
isReadable ,上课
ByteBuf
public boolean isWritable()
ByteBuf
true当且仅当
(this.capacity - this.writerIndex)大于
0 。
isWritable在课堂上
ByteBuf
public boolean isWritable(int size)
ByteBuf
true 。
isWritable
ByteBuf
public ByteBuf markReaderIndex()
ByteBuf
readerIndex 。
您可以重新定位当前readerIndex到标记readerIndex通过调用ByteBuf.resetReaderIndex() 。
标记的初始值readerIndex是0 。
markReaderIndex在课堂上
ByteBuf
public ByteBuf resetReaderIndex()
ByteBuf
readerIndex重新定位到此缓冲区中标记为
readerIndex 。
resetReaderIndex在课堂上
ByteBuf
public ByteBuf markWriterIndex()
ByteBuf
writerIndex 。
您可以通过致电ByteBuf.resetWriterIndex()将当前的writerIndex重新定位到标记为writerIndex的位置 。
标记的初始值writerIndex是0 。
markWriterIndex ,上课
ByteBuf
public ByteBuf resetWriterIndex()
ByteBuf
writerIndex重新定位到此缓冲区中标记为
writerIndex 。
resetWriterIndex
ByteBuf
public ByteBuf discardReadBytes()
ByteBuf
readerIndex之间的字节。
它移动之间的字节readerIndex和writerIndex至第0索引,并且设置readerIndex和writerIndex至0和oldWriterIndex - oldReaderIndex分别。
请参阅班级文件以获得更详细的解释。
discardReadBytes
ByteBuf
public ByteBuf discardSomeReadBytes()
ByteBuf
ByteBuf.discardReadBytes(),不同之
处在于此方法可能会丢弃部分,全部或者全部读取字节,具体取决于其内部实现方式,以减少潜在的额外内存消耗为代价降低整体内存带宽消耗。
discardSomeReadBytes ,上课
ByteBuf
public ByteBuf ensureWritable(int writableBytes)
ByteBuf
ensureWritable
ByteBuf
writableBytes - 可写入字节的预期最小数量
public int ensureWritable(int minWritableBytes,
boolean force)
ByteBuf
ByteBuf.ensureWritable(int)不同,此方法不引发异常但返回代码。
ensureWritable
ByteBuf
minWritableBytes - 可写入字节的预期最小数量
force - 当ByteBuf.writerIndex() + minWritableBytes > ByteBuf.maxCapacity() :
true - 缓冲区的容量扩展到ByteBuf.maxCapacity() false - 缓冲区容量不变 0如果缓冲区有足够的可写字节,并且其容量不变。
1如果缓冲区没有足够的字节,并且其容量不变。
2如果缓冲区有足够的可写字节,并且其容量已增加。
3如果缓冲区没有足够的字节,但其容量已增加到最大值。
public boolean getBoolean(int index)
ByteBuf
readerIndex或writerIndex 。
getBoolean在课堂上
ByteBuf
public byte getByte(int index)
ByteBuf
index处获取一个字节。
此方法不会修改此缓冲区的readerIndex或writerIndex 。
public short getUnsignedByte(int index)
ByteBuf
index处获取一个无符号字节。
此方法不会修改此缓冲区的readerIndex或writerIndex 。
getUnsignedByte在课堂上
ByteBuf
public short getShort(int index)
ByteBuf
index处获取一个16位短整数。
此方法不会修改此缓冲区的readerIndex或writerIndex 。
public short getShortLE(int index)
ByteBuf
index在此缓冲区的指定绝对index处获取一个16位短整数。
此方法不会修改此缓冲区的readerIndex或writerIndex 。
getShortLE在课堂上
ByteBuf
public int getUnsignedShort(int index)
ByteBuf
index处获取一个无符号的16位短整数。
此方法不会修改此缓冲区的readerIndex或writerIndex 。
getUnsignedShort在课堂上
ByteBuf
public int getUnsignedShortLE(int index)
ByteBuf
index处获取无符号的16位短整数。
此方法不会修改此缓冲区的readerIndex或writerIndex 。
getUnsignedShortLE在课堂上
ByteBuf
public int getMedium(int index)
ByteBuf
index处获取一个24位中等整数。
此方法不会修改此缓冲区的readerIndex或writerIndex 。
public int getMediumLE(int index)
ByteBuf
index处获取一个24位中等整数。
此方法不会修改此缓冲区的readerIndex或writerIndex 。
getMediumLE在课堂上
ByteBuf
public int getUnsignedMedium(int index)
ByteBuf
index处获取一个无符号的24位中等整数。
此方法不会修改此缓冲区的readerIndex或writerIndex 。
getUnsignedMedium在课堂上
ByteBuf
public int getUnsignedMediumLE(int index)
ByteBuf
index此缓冲区中指定绝对index处的无符号24位中等整数。
此方法不会修改此缓冲区的readerIndex或writerIndex 。
getUnsignedMediumLE在课堂上
ByteBuf
public int getInt(int index)
ByteBuf
index处获取一个32位整数。
此方法不会修改此缓冲区的readerIndex或writerIndex 。
public int getIntLE(int index)
ByteBuf
index处获取一个32位整数。
此方法不会修改此缓冲区的readerIndex或writerIndex 。
public long getUnsignedInt(int index)
ByteBuf
index处获取一个无符号的32位整数。
此方法不会修改此缓冲区的readerIndex或writerIndex 。
getUnsignedInt在课堂上
ByteBuf
public long getUnsignedIntLE(int index)
ByteBuf
index处获取无符号的32位整数。
此方法不会修改此缓冲区的readerIndex或writerIndex 。
getUnsignedIntLE
ByteBuf
public long getLong(int index)
ByteBuf
index处获取一个64位长整数。
此方法不会修改此缓冲区的readerIndex或writerIndex 。
public long getLongLE(int index)
ByteBuf
index处获取一个64位长整数。
此方法不会修改此缓冲区的readerIndex或writerIndex 。
public char getChar(int index)
ByteBuf
index处获取一个2字节的UTF-16字符。
此方法不会修改此缓冲区的readerIndex或writerIndex 。
public float getFloat(int index)
ByteBuf
index处获取一个32位浮点数。
此方法不会修改此缓冲区的readerIndex或writerIndex 。
public double getDouble(int index)
ByteBuf
index处获取一个64位浮点数。
此方法不会修改此缓冲区的readerIndex或writerIndex 。
public ByteBuf getBytes(int index, ByteBuf dst)
ByteBuf
index开始,直到目标变为不可写入。
此方法与ByteBuf.getBytes(int, ByteBuf, int, int)基本相同,不同之writerIndex于此方法将目标的writerIndex增加了传输字节数,而ByteBuf.getBytes(int, ByteBuf, int, int)则不增加。
此方法不会修改源缓冲区的readerIndex或writerIndex (即this )。
public ByteBuf getBytes(int index, ByteBuf dst, int length)
ByteBuf
index开始的目标index 。
此方法与ByteBuf.getBytes(int, ByteBuf, int, int)基本相同,不同之writerIndex于此方法通过传输字节数增加目标的writerIndex ,而ByteBuf.getBytes(int, ByteBuf, int, int)则不增加。
此方法不会修改源缓冲区的readerIndex或writerIndex (即this )。
public ByteBuf getBytes(int index, ByteBuf dst, int dstIndex, int length)
ByteBuf
index处开始的目标。
此方法不会修改源(即this )和目标的readerIndex或writerIndex 。
public ByteBuf getBytes(int index, byte[] dst)
ByteBuf
index开始的目标。
此方法不会修改此缓冲区的readerIndex或writerIndex
public ByteBuf getBytes(int index, byte[] dst, int dstIndex, int length)
ByteBuf
index 。
此方法不会修改此缓冲区的readerIndex或writerIndex 。
public ByteBuf getBytes(int index, java.nio.ByteBuffer dst)
ByteBuf
index开始,直到目标位置达到其限制。
此方法不会修改此缓冲区的readerIndex或writerIndex ,而目标的position将会增加。
public ByteBuf getBytes(int index, java.io.OutputStream out, int length) throws java.io.IOException
ByteBuf
index开始的流。
此方法不会修改此缓冲区的readerIndex或writerIndex 。
public int getBytes(int index,
java.nio.channels.GatheringByteChannel out,
int length)
throws java.io.IOException
ByteBuf
index 。
此方法不会修改此缓冲区的readerIndex或writerIndex 。
public int getBytes(int index,
java.nio.channels.FileChannel out,
long position,
int length)
throws java.io.IOException
ByteBuf
index到指定通道,从给定文件位置开始。
此方法不会修改此缓冲区的readerIndex或writerIndex 。
此方法不会修改频道的位置。
public java.lang.CharSequence getCharSequence(int index,
int length,
java.nio.charset.Charset charset)
ByteBuf
CharSequence 。
getCharSequence
ByteBuf
length - 阅读的长度
charset - 应该使用
public ByteBuf setBoolean(int index, boolean value)
ByteBuf
index处设置指定的布尔值。
此方法不会修改此缓冲区的readerIndex或writerIndex 。
setBoolean在课堂上
ByteBuf
public ByteBuf setByte(int index, int value)
ByteBuf
index处设置指定的字节。
指定值的24个高位被忽略。
此方法不会修改此缓冲区的readerIndex或writerIndex 。
public ByteBuf setShort(int index, int value)
ByteBuf
index处设置指定的16位短整数。
指定值的16个高位被忽略。
此方法不会修改此缓冲区的readerIndex或writerIndex 。
public ByteBuf setShortLE(int index, int value)
ByteBuf
index处设置指定的16位短整数。
指定值的16个高位被忽略。
此方法不会修改此缓冲区的readerIndex或writerIndex 。
setShortLE在课堂上
ByteBuf
public ByteBuf setMedium(int index, int value)
ByteBuf
index处设置指定的24位中等整数。
请注意,最高有效字节在指定值中被忽略。
此方法不会修改此缓冲区的readerIndex或writerIndex 。
public ByteBuf setMediumLE(int index, int value)
ByteBuf
index处设置指定的24位中等整数。
请注意,最高有效字节在指定值中被忽略。
此方法不会修改此缓冲区的readerIndex或writerIndex 。
setMediumLE在课程
ByteBuf
public ByteBuf setInt(int index, int value)
ByteBuf
index处设置指定的32位整数。
此方法不会修改此缓冲区的readerIndex或writerIndex 。
public ByteBuf setIntLE(int index, int value)
ByteBuf
index处设置指定的32位整数。
此方法不会修改此缓冲区的readerIndex或writerIndex 。
public ByteBuf setLong(int index, long value)
ByteBuf
index处设置指定的64位长整数。
此方法不会修改此缓冲区的readerIndex或writerIndex 。
public ByteBuf setLongLE(int index, long value)
ByteBuf
index处设置指定的64位长整数。
此方法不会修改此缓冲区的readerIndex或writerIndex 。
public ByteBuf setChar(int index, int value)
ByteBuf
index处设置指定的2字节UTF-16字符。
指定值的16个高位被忽略。
此方法不会修改此缓冲区的readerIndex或writerIndex 。
public ByteBuf setFloat(int index, float value)
ByteBuf
index处设置指定的32位浮点数。
此方法不会修改此缓冲区的readerIndex或writerIndex 。
public ByteBuf setDouble(int index, double value)
ByteBuf
index处设置指定的64位浮点数。
此方法不会修改此缓冲区的readerIndex或writerIndex 。
public ByteBuf setBytes(int index, ByteBuf src)
ByteBuf
index开始传输到此缓冲区,直到源缓冲区变得不可读。
此方法与ByteBuf.setBytes(int, ByteBuf, int, int)基本相同,不同之readerIndex于此方法将源缓冲区的readerIndex增加了传输字节数,而ByteBuf.setBytes(int, ByteBuf, int, int)则不增加。
此方法不会修改源缓冲区的readerIndex或writerIndex (即this )。
public ByteBuf setBytes(int index, ByteBuf src, int length)
ByteBuf
index开始传送到此缓冲区。
此方法与ByteBuf.setBytes(int, ByteBuf, int, int)基本相同,不同之readerIndex于此方法将源缓冲区的readerIndex增加了传输字节数,而ByteBuf.setBytes(int, ByteBuf, int, int)则不增加。
此方法不会修改源缓冲区的readerIndex或writerIndex (即this )。
public ByteBuf setBytes(int index, ByteBuf src, int srcIndex, int length)
ByteBuf
index开始传输到此缓冲区。
此方法不会修改源(即this )和目标的readerIndex或writerIndex 。
public ByteBuf setBytes(int index, byte[] src)
ByteBuf
index 。
此方法不会修改此缓冲区的readerIndex或writerIndex 。
public ByteBuf setBytes(int index, byte[] src, int srcIndex, int length)
ByteBuf
index 。
此方法不会修改此缓冲区的readerIndex或writerIndex 。
public ByteBuf setBytes(int index, java.nio.ByteBuffer src)
ByteBuf
index开始传输到此缓冲区,直到源缓冲区的位置达到其限制。
此方法不会修改此缓冲区的readerIndex或writerIndex 。
public int setBytes(int index,
java.io.InputStream in,
int length)
throws java.io.IOException
ByteBuf
index 。
此方法不会修改此缓冲区的readerIndex或writerIndex 。
public int setBytes(int index,
java.nio.channels.ScatteringByteChannel in,
int length)
throws java.io.IOException
ByteBuf
index开始传送到此缓冲区。
此方法不会修改此缓冲区的readerIndex或writerIndex 。
public int setBytes(int index,
java.nio.channels.FileChannel in,
long position,
int length)
throws java.io.IOException
ByteBuf
index 。
此方法不会修改此缓冲区的readerIndex或writerIndex 。
此方法不会修改频道的位置。
public ByteBuf setZero(int index, int length)
ByteBuf
index 。
此方法不会修改此缓冲区的readerIndex或writerIndex 。
public int setCharSequence(int index,
java.lang.CharSequence sequence,
java.nio.charset.Charset charset)
ByteBuf
CharSequence在当前
writerIndex并增加了
writerIndex由写入的字节。
setCharSequence在课堂上
ByteBuf
index - 应在其上写入序列
sequence - 写
charset - 应该使用。
public boolean readBoolean()
ByteBuf
readerIndex处获取布尔值,并在此缓冲区
readerIndex
1增加
readerIndex 。
readBoolean
ByteBuf
public byte readByte()
ByteBuf
readerIndex并增加
readerIndex通过
1在该缓冲液。
public short readUnsignedByte()
ByteBuf
readerIndex并增加了
readerIndex通过
1在该缓冲液。
readUnsignedByte ,上课
ByteBuf
public short readShort()
ByteBuf
readerIndex处获取16位短整数,并在此缓冲区
readerIndex
2增加
readerIndex 。
public short readShortLE()
ByteBuf
readerIndex处获取一个16位短整数,并在此缓冲区中增加
readerIndex
2 。
readShortLE在课程
ByteBuf
public int readUnsignedShort()
ByteBuf
readerIndex处获取一个无符号的16位短整数,并在此缓冲区
readerIndex
2增加
readerIndex 。
readUnsignedShort在课堂上
ByteBuf
public int readUnsignedShortLE()
ByteBuf
readerIndex在Little Endian字节序,并增加了
readerIndex通过
2在缓冲区中。
readUnsignedShortLE在课堂上
ByteBuf
public int readMedium()
ByteBuf
readerIndex处获取24位中等整数,并在此缓冲区
readerIndex
3增加
readerIndex 。
readMedium在课堂上
ByteBuf
public int readMediumLE()
ByteBuf
readerIndex处获取一个24位中等整数,并在此缓冲区
readerIndex
3增加
readerIndex 。
readMediumLE
ByteBuf
public int readUnsignedMedium()
ByteBuf
readerIndex处获取一个无符号的24位中等整数,并在此缓冲区
readerIndex
3增加
readerIndex 。
readUnsignedMedium在课堂上
ByteBuf
public int readUnsignedMediumLE()
ByteBuf
readerIndex在Little Endian字节序,并增加了
readerIndex通过
3在该缓冲液。
readUnsignedMediumLE在课堂
ByteBuf
public int readInt()
ByteBuf
readerIndex处获取32位整数,并在此缓冲区
readerIndex
4增加
readerIndex 。
public int readIntLE()
ByteBuf
readerIndex处获取32位整数,并在此缓冲区
readerIndex
4增加
readerIndex 。
public long readUnsignedInt()
ByteBuf
readerIndex处获取一个无符号的32位整数,并在此缓冲区
readerIndex
4增加
readerIndex 。
readUnsignedInt在课堂上
ByteBuf
public long readUnsignedIntLE()
ByteBuf
readerIndex处获取一个无符号的32位整数,并在此缓冲区
readerIndex
4增加
readerIndex 。
readUnsignedIntLE ,上课
ByteBuf
public long readLong()
ByteBuf
readerIndex处获取64位整数,并在此缓冲区
readerIndex
8增加
readerIndex 。
public long readLongLE()
ByteBuf
readerIndex在Little Endian字节序,并增加了
readerIndex通过
8在该缓冲液。
readLongLE
ByteBuf
public char readChar()
ByteBuf
readerIndex处获取2字节的UTF-16字符,并在此缓冲区
readerIndex
2增加
readerIndex 。
public float readFloat()
ByteBuf
readerIndex处获取一个32位浮点数,并在此缓冲区
readerIndex
4增加
readerIndex 。
public double readDouble()
ByteBuf
readerIndex处获得一个64位浮点数,并在此缓冲区
readerIndex
8增加
readerIndex 。
readDouble在课堂上
ByteBuf
public ByteBuf readBytes(int length)
ByteBuf
readerIndex并增加了readerIndex由传输的字节(=数量length )。
返回缓冲区的readerIndex和writerIndex是0和length分别。
public ByteBuf readSlice(int length)
ByteBuf
readerIndex并增加了readerIndex由新的切片(=大小length )。
另外请注意,此方法不会调用ByteBuf.retain() ,因此引用计数不会增加。
public ByteBuf readRetainedSlice(int length)
ByteBuf
readerIndex并增加了readerIndex由新的切片(=大小length )。
请注意,与ByteBuf.readSlice(int)不同,此方法返回retained缓冲区。 此方法的行为与readSlice(...).retain()类似,只是此方法可能会返回一个生成较少垃圾的缓冲区实现。
readRetainedSlice
ByteBuf
length - 新切片的大小
public ByteBuf readBytes(ByteBuf dst)
ByteBuf
readerIndex开始,直到目标变为不可写,并将传输的字节数增加readerIndex 。
此方法与ByteBuf.readBytes(ByteBuf, int, int)基本相同,不同之writerIndex于此方法通过传输字节数增加目标的writerIndex ,而ByteBuf.readBytes(ByteBuf, int, int)则不增加。
public ByteBuf readBytes(ByteBuf dst, int length)
ByteBuf
readerIndex并增加了readerIndex由传输的字节(=数量length )。
此方法与ByteBuf.readBytes(ByteBuf, int, int)基本相同,不同之writerIndex于此方法通过传输的字节数(= length )增加目标的writerIndex ,而ByteBuf.readBytes(ByteBuf, int, int)则不增加。
public ByteBuf readBytes(ByteBuf dst, int dstIndex, int length)
ByteBuf
readerIndex并增加了
readerIndex由传输的字节(=数量
length )。
public ByteBuf readBytes(byte[] dst)
ByteBuf
readerIndex并增加了
readerIndex由传输的字节(=数量
dst.length )。
public ByteBuf readBytes(byte[] dst, int dstIndex, int length)
ByteBuf
readerIndex并增加了
readerIndex由传输的字节(=数量
length )。
public ByteBuf readBytes(java.nio.ByteBuffer dst)
ByteBuf
readerIndex开始,直到目标的位置达到其限制,并将传输的字节数增加
readerIndex 。
public ByteBuf readBytes(java.io.OutputStream out, int length) throws java.io.IOException
ByteBuf
readerIndex开始的指定流。
public int readBytes(java.nio.channels.GatheringByteChannel out,
int length)
throws java.io.IOException
ByteBuf
readerIndex开始的指定流。
public int readBytes(java.nio.channels.FileChannel out,
long position,
int length)
throws java.io.IOException
ByteBuf
readerIndex到指定的通道,从给定的文件位置开始。
此方法不会修改频道的位置。
public java.lang.CharSequence readCharSequence(int length,
java.nio.charset.Charset charset)
ByteBuf
readerIndex处获得具有给定长度的
CharSequence ,并将该长度增加
readerIndex 。
readCharSequence在课堂上
ByteBuf
length - 要阅读的长度
charset - 应该使用
public ByteBuf skipBytes(int length)
ByteBuf
length增加当前
readerIndex 。
public ByteBuf writeBoolean(boolean value)
ByteBuf
writerIndex处设置指定的布尔值,并在此缓冲区
writerIndex
1增加
writerIndex 。
writeBoolean ,上课
ByteBuf
public ByteBuf writeByte(int value)
ByteBuf
writerIndex处设置指定的字节,并在此缓冲区writerIndex 1增加writerIndex 。
指定值的24个高位被忽略。
public ByteBuf writeShort(int value)
ByteBuf
writerIndex处设置指定的16位短整数,并在此缓冲区writerIndex 2增加writerIndex 。
指定值的16个高位被忽略。
writeShort在课堂上
ByteBuf
public ByteBuf writeShortLE(int value)
ByteBuf
writerIndex处设置Little Endian Byte Order中指定的16位短整数,并在此缓冲区writerIndex 2增加writerIndex 。
指定值的16个高位被忽略。
writeShortLE
ByteBuf
public ByteBuf writeMedium(int value)
ByteBuf
writerIndex中设置指定的24位中等整数,并在此缓冲区
writerIndex
3增加
writerIndex 。
writeMedium ,上课
ByteBuf
public ByteBuf writeMediumLE(int value)
ByteBuf
writerIndex处设置指定的24位中等整数,并在此缓冲区
writerIndex
3增加
writerIndex 。
writeMediumLE在课堂上
ByteBuf
public ByteBuf writeInt(int value)
ByteBuf
writerIndex处设置指定的32位整数,并在此缓冲区
writerIndex
4增加
writerIndex 。
public ByteBuf writeIntLE(int value)
ByteBuf
writerIndex在Little Endian字节序,并增加了
writerIndex通过
4在该缓冲液。
writeIntLE ,上课
ByteBuf
public ByteBuf writeLong(long value)
ByteBuf
writerIndex处设置指定的64位长整数,并在此缓冲区
writerIndex
8增加
writerIndex 。
public ByteBuf writeLongLE(long value)
ByteBuf
writerIndex处设置指定的64位长整数,并在此缓冲区
writerIndex
8增加
writerIndex 。
writeLongLE在类
ByteBuf
public ByteBuf writeChar(int value)
ByteBuf
writerIndex处设置指定的2字节UTF-16字符,并在此缓冲区writerIndex 2增加writerIndex 。
指定值的16个高位被忽略。
public ByteBuf writeFloat(float value)
ByteBuf
writerIndex处设置指定的32位浮点数,并在此缓冲区
writerIndex
4增加
writerIndex 。
writeFloat在课堂上
ByteBuf
public ByteBuf writeDouble(double value)
ByteBuf
writerIndex处设置指定的64位浮点数并在此缓冲区
writerIndex
8增加
writerIndex 。
writeDouble在课堂上
ByteBuf
public ByteBuf writeBytes(ByteBuf src)
ByteBuf
writerIndex开始,直到源缓冲区变得不可读,并将传输字节数增加writerIndex 。
此方法与ByteBuf.writeBytes(ByteBuf, int, int)基本相同,不同之readerIndex于此方法将源缓冲区的readerIndex增加了传输字节数,而ByteBuf.writeBytes(ByteBuf, int, int)则不增加。
writeBytes ,上课
ByteBuf
public ByteBuf writeBytes(ByteBuf src, int length)
ByteBuf
writerIndex并增加了writerIndex由传输的字节(=数量length )。
此方法与ByteBuf.writeBytes(ByteBuf, int, int)基本相同,不同之readerIndex于此方法将源缓冲区的readerIndex增加了传输字节数(= length ),而ByteBuf.writeBytes(ByteBuf, int, int)则不增加。
writeBytes在课堂上
ByteBuf
length - 要传输的字节数
public ByteBuf writeBytes(ByteBuf src, int srcIndex, int length)
ByteBuf
writerIndex并增加了
writerIndex由传输的字节(=数量
length )。
writeBytes在课堂上
ByteBuf
srcIndex - 来源的第一个索引
length - 要传输的字节数
public ByteBuf writeBytes(byte[] src)
ByteBuf
writerIndex并增加了
writerIndex由传输的字节(=数量
src.length )。
writeBytes在课堂上
ByteBuf
public ByteBuf writeBytes(byte[] src, int srcIndex, int length)
ByteBuf
writerIndex并增加了
writerIndex由传输的字节(=数量
length )。
writeBytes在课堂上
ByteBuf
srcIndex - 来源的第一个索引
length - 要传输的字节数
public ByteBuf writeBytes(java.nio.ByteBuffer src)
ByteBuf
writerIndex开始传输到此缓冲区,直到源缓冲区的位置达到其限制,并将传输的字节数增加
writerIndex 。
writeBytes在课堂上
ByteBuf
public int writeBytes(java.io.InputStream in,
int length)
throws java.io.IOException
ByteBuf
writerIndex开始,并通过传输的字节数增加
writerIndex 。
writeBytes在课堂上
ByteBuf
length - 要传输的字节数
java.io.IOException - 如果指定的流在I / O期间抛出异常
public int writeBytes(java.nio.channels.ScatteringByteChannel in,
int length)
throws java.io.IOException
ByteBuf
writerIndex开始传送到此缓冲区,并通过传送的字节数增加
writerIndex 。
writeBytes在课堂上
ByteBuf
length - 传输的最大字节数
java.io.IOException - 如果指定的通道在I / O期间引发异常
public int writeBytes(java.nio.channels.FileChannel in,
long position,
int length)
throws java.io.IOException
ByteBuf
writerIndex开始,并通过传输的字节数增加writerIndex 。
此方法不会修改频道的位置。
writeBytes
ByteBuf
position - 传输开始的文件位置
length - 传输的最大字节数
java.io.IOException - 如果指定的通道在I / O期间引发异常
public ByteBuf writeZero(int length)
ByteBuf
writerIndex增加
writerIndex指定的
length 。
public int writeCharSequence(java.lang.CharSequence sequence,
java.nio.charset.Charset charset)
ByteBuf
CharSequence在当前writerIndex并增加了writerIndex由写入的字节。
在这个缓冲区中。
writeCharSequence在类
ByteBuf
sequence - 写
charset - 应该使用
public int indexOf(int fromIndex,
int toIndex,
byte value)
ByteBuf
value 。
搜索从指定的fromIndex (含)到指定的toIndex ( toIndex )。
如果fromIndex大于toIndex ,则搜索按相反顺序执行。
此方法不会修改此缓冲区的readerIndex或writerIndex 。
public int bytesBefore(byte value)
ByteBuf
value 。
搜索从当前的readerIndex (含)到当前的writerIndex ( writerIndex )。
此方法不会修改此缓冲区的readerIndex或writerIndex 。
bytesBefore
ByteBuf
readerIndex与第一个匹配项之间的字节数(如果找到)。
-1否则。
public int bytesBefore(int length,
byte value)
ByteBuf
value 。
搜索从当前的readerIndex (含)开始并持续指定的length 。
此方法不会修改此缓冲区的readerIndex或writerIndex 。
bytesBefore在课堂上
ByteBuf
readerIndex与第一个匹配项之间的字节数(如果找到)。
-1否则。
public int bytesBefore(int index,
int length,
byte value)
ByteBuf
value 。
搜索从指定的index (含)开始并持续指定的length 。
此方法不会修改此缓冲区的readerIndex或writerIndex 。
bytesBefore在课程
ByteBuf
index与第一个匹配项之间的字节数(如果找到)。
-1否则。
public int forEachByte(ByteProcessor processor)
ByteBuf
processor按升序对此缓冲区的可读字节进行迭代。
forEachByte
ByteBuf
-1如果处理器迭代到或超出可读字节的末尾。
上次访问的索引如果ByteProcessor.process(byte)返回false 。
public int forEachByte(int index,
int length,
ByteProcessor processor)
ByteBuf
processor按升序对此缓冲区的指定区域进行迭代。
(即index , (index + 1) ,.. (index + length - 1) )
forEachByte在课堂上
ByteBuf
-1如果处理器迭代到或超出指定区域的末尾。
最后访问的索引如果ByteProcessor.process(byte)返回false 。
public int forEachByteDesc(ByteProcessor processor)
ByteBuf
processor按降序对此缓冲区的可读字节进行迭代。
forEachByteDesc在课堂上
ByteBuf
-1如果处理器迭代到或超出可读字节的开头。
最后访问的索引如果ByteProcessor.process(byte)返回false 。
public int forEachByteDesc(int index,
int length,
ByteProcessor processor)
ByteBuf
processor以递减顺序遍历此缓冲区的指定区域。
(即(index + length - 1) , (index + length - 2) ,... index )
forEachByteDesc在课堂上
ByteBuf
-1如果处理器迭代到或超出指定区域的开始位置。
上次访问的索引如果ByteProcessor.process(byte)返回false 。
public ByteBuf copy()
ByteBuf
buf.copy(buf.readerIndex(), buf.readableBytes())相同。
此方法不会修改此缓冲区的readerIndex或writerIndex 。
public ByteBuf copy(int index, int length)
ByteBuf
readerIndex或writerIndex 。
public ByteBuf slice()
ByteBuf
buf.slice(buf.readerIndex(), buf.readableBytes())相同。
此方法不会修改此缓冲区的readerIndex或writerIndex 。
另外请注意,此方法不会调用ByteBuf.retain() ,因此引用计数不会增加。
public ByteBuf retainedSlice()
ByteBuf
buf.slice(buf.readerIndex(), buf.readableBytes())相同。
此方法不会修改此缓冲区的readerIndex或writerIndex 。
请注意,与ByteBuf.slice()不同,此方法返回retained缓冲区。 此方法的行为与slice().retain()类似,只是此方法可能会返回一个生成较少垃圾的缓冲区实现。
retainedSlice在课堂上
ByteBuf
public ByteBuf slice(int index, int length)
ByteBuf
readerIndex或writerIndex 。
也请注意,此方法不会调用ByteBuf.retain() ,因此引用计数不会增加。
public ByteBuf retainedSlice(int index, int length)
ByteBuf
readerIndex或writerIndex 。
请注意,与ByteBuf.slice(int, int)不同,此方法返回retained缓冲区。 此方法的行为与slice(...).retain()行为类似,只不过此方法可能会返回一个生成较少垃圾的缓冲区实现。
retainedSlice在课程
ByteBuf
public ByteBuf duplicate()
ByteBuf
readerIndex或writerIndex 。
读者和作家的标记不会重复。 另外请注意,此方法不会调用ByteBuf.retain() ,因此引用计数不会增加。
duplicate
ByteBuf
ByteBuf.slice()返回的缓冲区的缓冲区。
然而,这个缓冲区将共享底层缓冲区的容量,因此如果需要的话允许访问所有的底层内容。
public ByteBuf retainedDuplicate()
ByteBuf
buf.slice(0, buf.capacity())相同。
此方法不会修改此缓冲区的readerIndex或writerIndex 。
请注意,与ByteBuf.slice(int, int)不同,此方法返回retained缓冲区。 此方法的行为与duplicate().retain()行为类似,只不过此方法可能会返回一个生成较少垃圾的缓冲区实现。
retainedDuplicate在课程
ByteBuf
public int nioBufferCount()
ByteBuf
ByteBuffer的最大数量。
请注意, ByteBuf.nioBuffers()或ByteBuf.nioBuffers(int, int)可能会返回更少数量的ByteBuffer s。
nioBufferCount ,上课
ByteBuf
-1如果此缓冲区没有基础ByteBuffer 。
如果此缓冲区至少有一个基础ByteBuffer ,则基础ByteBuffer的ByteBuffer 。
请注意,此方法不返回0以避免混淆。
ByteBuf.nioBuffer() ,
ByteBuf.nioBuffer(int, int) ,
ByteBuf.nioBuffers() ,
ByteBuf.nioBuffers(int, int)
public java.nio.ByteBuffer nioBuffer()
ByteBuf
ByteBuffer 。
返回的缓冲区共享或包含此缓冲区的复制内容,同时更改返回的NIO缓冲区的位置和限制不会影响此缓冲区的索引和标记。
该方法与buf.nioBuffer(buf.readerIndex(), buf.readableBytes())相同。
此方法不会修改此缓冲区的readerIndex或writerIndex 。
请注意,如果此缓冲区是动态缓冲区并且它调整了其容量,则返回的NIO缓冲区将不会看到此缓冲区的更改。
nioBuffer
ByteBuf
ByteBuf.nioBufferCount() ,
ByteBuf.nioBuffers() ,
ByteBuf.nioBuffers(int, int)
public java.nio.ByteBuffer nioBuffer(int index,
int length)
ByteBuf
ByteBuffer 。
返回的缓冲区共享或包含此缓冲区的复制内容,同时更改返回的NIO缓冲区的位置和限制不会影响此缓冲区的索引和标记。
此方法不会修改此缓冲区的readerIndex或writerIndex 。
请注意,如果此缓冲区是动态缓冲区并且它调整了其容量,则返回的NIO缓冲区将不会看到此缓冲区的更改。
nioBuffer在类
ByteBuf
ByteBuf.nioBufferCount() ,
ByteBuf.nioBuffers() ,
ByteBuf.nioBuffers(int, int)
public java.nio.ByteBuffer internalNioBuffer(int index,
int length)
ByteBuf
internalNioBuffer在课程
ByteBuf
public java.nio.ByteBuffer[] nioBuffers()
ByteBuf
ByteBuffer的形式公开此缓冲区的可读字节。
返回的缓冲区共享或包含此缓冲区的复制内容,同时更改返回的NIO缓冲区的位置和限制不会影响此缓冲区的索引和标记。
此方法不会修改此缓冲区的readerIndex或writerIndex 。
请注意,如果此缓冲区是动态缓冲区并且它调整了其容量,则返回的NIO缓冲区将不会看到此缓冲区的更改。
nioBuffers ,上课
ByteBuf
ByteBuf.nioBufferCount() ,
ByteBuf.nioBuffer() ,
ByteBuf.nioBuffer(int, int)
public java.nio.ByteBuffer[] nioBuffers(int index,
int length)
ByteBuf
ByteBuffer返回的缓冲区共享或包含此缓冲区的复制内容,同时更改返回的NIO缓冲区的位置和限制不会影响此索引和标记缓冲。
此方法不会修改此缓冲区的readerIndex或writerIndex 。
请注意,如果此缓冲区是动态缓冲区并且它调整了其容量,则返回的NIO缓冲区将不会看到此缓冲区的更改。
nioBuffers ,上课
ByteBuf
ByteBuf.nioBufferCount() ,
ByteBuf.nioBuffer() ,
ByteBuf.nioBuffer(int, int)
public boolean hasArray()
ByteBuf
true当且仅当此缓冲区有一个后备字节数组。
如果此方法返回true,则可以安全地调用ByteBuf.array()和ByteBuf.arrayOffset() 。
public int arrayOffset()
ByteBuf
arrayOffset在课堂上
ByteBuf
public boolean hasMemoryAddress()
ByteBuf
true 。
hasMemoryAddress ,上课
ByteBuf
public long memoryAddress()
ByteBuf
memoryAddress ,上课
ByteBuf
public java.lang.String toString(java.nio.charset.Charset charset)
ByteBuf
buf.toString(buf.readerIndex(), buf.readableBytes(), charsetName)相同。
此方法不会修改此缓冲区的readerIndex或writerIndex 。
public java.lang.String toString(int index,
int length,
java.nio.charset.Charset charset)
ByteBuf
readerIndex或writerIndex 。
public int refCnt()
ReferenceCounted
0 ,则表示此对象已被释放。
public ByteBuf retain()
ReferenceCounted复制的描述
1 。
retain ,界面
ReferenceCounted
retain在课堂上
ByteBuf
public ByteBuf retain(int increment)
ReferenceCounted
increment 。
retain ,界面
ReferenceCounted
retain
ByteBuf
public ByteBuf touch()
ReferenceCounted
touch接口
ReferenceCounted
touch在课堂上
ByteBuf
public ByteBuf touch(java.lang.Object hint)
ReferenceCounted
ResourceLeakDetector提供给您。
touch在界面
ReferenceCounted
touch在课堂上
ByteBuf
public boolean release()
ReferenceCounted复制的描述
1并且如果所述引用计数达到在将释放该对象
0 。
true当且仅当引用计数变为
0且此对象已被释放
public boolean release(int decrement)
ReferenceCounted复制的描述
decrement并且如果所述引用计数达到在将释放该对象
0 。
true当且仅当引用计数变为
0且此对象已被释放
public int hashCode()
ByteBuf
public boolean equals(java.lang.Object obj)
ByteBuf
ByteBuf.readerIndex()和ByteBuf.writerIndex() 。
此方法还为null返回false ,并返回一个不是ByteBuf类型实例的对象 。
public int compareTo(ByteBuf buffer)
ByteBuf
strcmp , memcmp和String.compareTo(String) 。
public java.lang.String toString()
ByteBuf
ByteBuf.readerIndex() , ByteBuf.writerIndex()和ByteBuf.capacity() 。
Copyright © 2008–2018 The Netty Project. All rights reserved.