public class FastByteBuffer extends FastBuffer
buffersCount, currentBufferIndex, minChunkLen, offset, size
Constructor and Description |
---|
FastByteBuffer()
构造
|
FastByteBuffer(int size)
构造
|
Modifier and Type | Method and Description |
---|---|
FastByteBuffer |
append(byte element)
向快速缓冲加入一个字节
|
FastByteBuffer |
append(byte[] array)
向快速缓冲加入数据
|
FastByteBuffer |
append(byte[] array,
int off,
int len)
向快速缓冲加入数据
|
FastByteBuffer |
append(FastByteBuffer buff)
将另一个快速缓冲加入到自身
|
byte[] |
array(int index)
根据索引位返回缓冲集中的缓冲
|
protected void |
ensureCapacity(int capacity)
检查现有缓冲区是否满足capacity,不满足则分配新的区域分配下一个缓冲区,不会小于1024
|
byte |
get(int index)
根据索引位返回一个字节
|
void |
reset()
复位缓冲
|
byte[] |
toArray()
返回快速缓冲中的数据
|
byte[] |
toArray(int start,
int len)
返回快速缓冲中的数据
|
byte[] |
toArrayZeroCopyIfPossible()
返回快速缓冲中的数据,如果缓冲区中的数据长度固定,则直接返回原始数组
注意此方法共享数组,不能修改数组内容! |
index, isEmpty, length, offset
public FastByteBuffer()
public FastByteBuffer(int size)
size
- 一个缓冲区的最小字节数public FastByteBuffer append(byte[] array, int off, int len)
array
- 数据off
- 偏移量len
- 字节数public FastByteBuffer append(byte[] array)
array
- 数据public FastByteBuffer append(byte element)
element
- 一个字节的数据public FastByteBuffer append(FastByteBuffer buff)
buff
- 快速缓冲public byte[] array(int index)
index
- 索引位public void reset()
FastBuffer
reset
in class FastBuffer
public byte[] toArrayZeroCopyIfPossible()
public byte[] toArray()
public byte[] toArray(int start, int len)
start
- 逻辑起始位置len
- 逻辑字节长public byte get(int index)
index
- 索引位protected void ensureCapacity(int capacity)
FastBuffer
ensureCapacity
in class FastBuffer
capacity
- 理想缓冲区字节数Copyright © 2025. All rights reserved.