Skip to content

Commit 7230e4a

Browse files
author
anaer
authored
Update ByteBuf容器.md
typo
1 parent 47292b6 commit 7230e4a

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

netty-learning/ByteBuf容器.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@ readerIndex和writerIndex到达同一位置(已经读取到末尾了),Byte
5555
当我们调用ByteBuf以read或write开头的方法时,将会增加这个ByteBuf的读索引或写索引,而诸如set或get
5656
的方法则不会改变索引。
5757

58-
我们可以指定ByteBuf的最大容量,如果对ByteBuf的写入操作导致writerIndex超出了最大人容量,那么程序将会
59-
抛出一个异常,ByteBuf的最大人容量是Integer.MAX_VALUE。
58+
我们可以指定ByteBuf的最大容量,如果对ByteBuf的写入操作导致writerIndex超出了最大容量,那么程序将会
59+
抛出一个异常,ByteBuf的最大容量是Integer.MAX_VALUE。
6060

6161
ByteBuf大致的结构和状态:
6262

@@ -67,7 +67,7 @@ ByteBuf大致的结构和状态:
6767
ByteBuf有多种使用模式,我们可以根据需求构建不同使用模式的ByteBuf。
6868

6969
- 堆缓冲区(HeapByteBuf): 最常用的ByteBuf模式是将数据存储在JVM的堆空间中,实际上是通过数组存储数据,
70-
所以这种模式被称为支撑数组(Backing Array )。所以这种模式被称为支撑数组可以在没有使用池化的情况下快速分配和释放
70+
所以这种模式被称为支撑数组(Backing Array)。它可以在没有使用池化的情况下快速分配和释放
7171
适合用于有遗留数据需要处理的情况。
7272

7373
![堆缓冲区模式](../img/netty/堆缓冲区模式.png)
@@ -220,16 +220,16 @@ Netty提供了两种ByteBufAllocator的实现: PooledByteBufAllocator和Unpool
220220
PooledByteBufAllocator池化了ByteBuf的实例以提高性能并最大限度的减少内存碎片,此实现的分配内存的方法
221221
是使用[jemalloc](https://people.freebsd.org/~jasone/jemalloc/bsdcan2006/jemalloc.pdf),此种
222222
方法分配内存的效率非常高,已被大量现代操作系统采用。 UnpooledByteBufAllocator则不会池化ByteBuf,
223-
Netty默认使用的是PooledByteBufALlocator
223+
Netty默认使用的是PooledByteBufAllocator
224224

225225

226226
#### Unpooled
227227
当Channel或ChannelHandlerContext未引用ByteBufAllocator时,就无法使用ByteBufAllocator来分配
228-
ByteBUf,对于这种情况,Netty提供了Unpooled工具类,它提供了一系列的静态方法来分配未池化的ByteBuf。
228+
ByteBuf,对于这种情况,Netty提供了Unpooled工具类,它提供了一系列的静态方法来分配未池化的ByteBuf。
229229

230230

231231
#### ByteBufUtil
232-
ByteBufUtil是ByteBuf的一个工具类,它提供大量操作ByteBuf的方法,其中非常重要的一个方法就是
232+
ByteBufUtil是ByteBuf的一个工具类,它提供大量操作ByteBuf的方法,其中非常重要的一个方法就是
233233
hexDump,这个方法会以16进制的形式来表示ByteBuf的内容。另一个很重要的方法是equals,它被用于判断
234234
ByteBuf之间的相等性。
235235

0 commit comments

Comments
 (0)