public final class Segment extends Object
limit及以上 每个字节数组都有一个单独的拥有段 的立场,
限制、prev和next引用不共享| Modifier and Type | Field and Description |
|---|---|
byte[] |
data |
int |
limit
The first byte of available data ready to be written to.
|
Segment |
next
Next segment in a linked or circularly-linked list.
|
boolean |
owner
True if this segment owns the byte array and can append to it, extending
limit. |
int |
pos
The next byte of application data byte to read in this segment.
|
Segment |
prev
Previous segment in a circularly-linked list.
|
static int |
SHARE_MINIMUM
Segments will be shared when doing so avoids
arraycopy() of this many bytes. |
boolean |
shared
True if other segments or byte strings use the same byte array.
|
static int |
SIZE
The size of all segments in bytes.
|
| Modifier and Type | Method and Description |
|---|---|
void |
compact() |
Segment |
pop() |
Segment |
push(Segment segment) |
Segment |
sharedCopy() |
Segment |
split(int byteCount) |
Segment |
unsharedCopy() |
void |
writeTo(Segment sink,
int byteCount) |
public static final int SIZE
public static final int SHARE_MINIMUM
arraycopy() of this many bytes.public final byte[] data
public int pos
public int limit
public boolean shared
public boolean owner
limit.public Segment next
public Segment prev
Copyright © 2019. All rights reserved.