public class TByteBuffer extends Object
Modifier and Type | Field and Description |
---|---|
static Field |
addressField |
static Long |
addressFieldOffset |
static Field |
attField |
static Long |
attFieldOffset |
static int |
BYTE_BUFFER_ANALYSIS |
static LongAdder |
BYTE_BUFFER_COUNT |
static Field |
capacityField |
static Long |
capacityFieldOffset |
static int |
DEFAULT_BYTE_BUFFER_SIZE |
static Class |
DIRECT_BYTE_BUFFER_CLASS |
static Constructor |
DIRECT_BYTE_BUFFER_CONSTURCTOR |
static ByteBuffer |
EMPTY_BYTE_BUFFER |
static LongAdder |
MALLOC_COUNT |
static LongAdder |
MALLOC_SIZE |
static int |
THREAD_BUFFER_POOL_SIZE |
static ThreadObjectPool<ByteBuffer> |
THREAD_BYTE_BUFFER_POOL |
static sun.misc.Unsafe |
UNSAFE |
Constructor and Description |
---|
TByteBuffer() |
Modifier and Type | Method and Description |
---|---|
static ByteBuffer |
allocateDirect()
根据框架的非堆内存配置, 分配 ByteBuffer
|
static ByteBuffer |
allocateDirect(int capacity)
根据框架的非堆内存配置, 分配 ByteBuffer
|
protected static ByteBuffer |
allocateManualReleaseBuffer(int capacity)
分配可能手工进行释放的 ByteBuffer
|
static ByteBuffer |
append(ByteBuffer srcBuffer,
int srcPosition,
ByteBuffer appendBuffer,
int appendPosition,
int length)
在 srcBuffer 后追加 appendBuffer;
|
static ByteBuffer |
copy(ByteBuffer byteBuffer)
复制一个 Bytebuffer 对象
|
static void |
free(int capacity) |
static Long |
getAddress(ByteBuffer byteBuffer)
获取内存地址
|
static Object |
getAtt(ByteBuffer byteBuffer)
获取附加对象
|
static Map<String,Long> |
getByteBufferAnalysis() |
static int |
indexOf(ByteBuffer byteBuffer,
byte[] mark)
查找特定 byte 标识的位置
byte 标识数组第一个字节的索引位置
|
static boolean |
isReleased(ByteBuffer byteBuffer)
判断是否已经释放
|
static void |
malloc(int capacity) |
static boolean |
move(ByteBuffer byteBuffer,
int offset)
移动 Bytebuffer 中的数据
以Bytebuffer.position()为原点,移动 offset 个位置
|
static void |
realloc(int oldCapacity,
int newCapacity) |
static boolean |
reallocate(ByteBuffer byteBuffer,
int newSize)
重新分配 byteBuffer 中的空间大小
|
static void |
release(ByteBuffer byteBuffer)
释放byteBuffer
释放对外的 bytebuffer
|
static void |
setAddress(ByteBuffer byteBuffer,
long address)
设置内存地址
|
static void |
setAttr(ByteBuffer byteBuffer,
Object attr)
设置附加对象
|
static void |
setCapacity(ByteBuffer byteBuffer,
int capacity)
设置内存地址
|
static byte[] |
toArray(ByteBuffer bytebuffer)
将ByteBuffer转换成 byte 数组
|
static String |
toString(ByteBuffer bytebuffer)
将 Bytebuffer 转换成 字符串
|
static String |
toString(ByteBuffer bytebuffer,
String charset)
将 Bytebuffer 转换成 字符串
|
public static final sun.misc.Unsafe UNSAFE
public static final int DEFAULT_BYTE_BUFFER_SIZE
public static final int THREAD_BUFFER_POOL_SIZE
public static final LongAdder MALLOC_SIZE
public static final LongAdder MALLOC_COUNT
public static final LongAdder BYTE_BUFFER_COUNT
public static final int BYTE_BUFFER_ANALYSIS
public static final ThreadObjectPool<ByteBuffer> THREAD_BYTE_BUFFER_POOL
public static final ByteBuffer EMPTY_BYTE_BUFFER
public static final Class DIRECT_BYTE_BUFFER_CLASS
public static final Constructor DIRECT_BYTE_BUFFER_CONSTURCTOR
public static final Field addressField
public static final Long addressFieldOffset
public static final Field capacityField
public static final Long capacityFieldOffset
public static final Field attField
public static final Long attFieldOffset
public static void malloc(int capacity)
public static void realloc(int oldCapacity, int newCapacity)
public static void free(int capacity)
protected static ByteBuffer allocateManualReleaseBuffer(int capacity)
capacity
- 容量public static ByteBuffer allocateDirect()
public static ByteBuffer allocateDirect(int capacity)
capacity
- 容量public static boolean reallocate(ByteBuffer byteBuffer, int newSize)
byteBuffer
- byteBuffer对象newSize
- 重新分配的空间大小public static boolean move(ByteBuffer byteBuffer, int offset)
byteBuffer
- byteBuffer对象offset
- 相对当前 ByteBuffer.position 的偏移量public static ByteBuffer copy(ByteBuffer byteBuffer) throws ReflectiveOperationException
byteBuffer
- 原 ByteBuffer 对象ReflectiveOperationException
- 反射错误public static ByteBuffer append(ByteBuffer srcBuffer, int srcPosition, ByteBuffer appendBuffer, int appendPosition, int length)
srcBuffer
- 被追加数据的 srcBuffersrcPosition
- 被追加数据的位置appendBuffer
- 追加的内容appendPosition
- 追加的数据起始位置length
- 追加数据的长度public static void release(ByteBuffer byteBuffer)
byteBuffer
- bytebuffer 对象public static boolean isReleased(ByteBuffer byteBuffer)
byteBuffer
- ByteBuffer 对象public static byte[] toArray(ByteBuffer bytebuffer)
bytebuffer
- ByteBuffer 对象public static String toString(ByteBuffer bytebuffer, String charset)
bytebuffer
- Bytebuffer 对象charset
- 字符集public static String toString(ByteBuffer bytebuffer)
bytebuffer
- Bytebuffer 对象public static int indexOf(ByteBuffer byteBuffer, byte[] mark)
byteBuffer
- Bytebuffer 对象mark
- byte 标识数组public static Long getAddress(ByteBuffer byteBuffer) throws ReflectiveOperationException
byteBuffer
- bytebuffer 对象ReflectiveOperationException
- 反射异常public static void setAddress(ByteBuffer byteBuffer, long address) throws ReflectiveOperationException
byteBuffer
- bytebuffer 对象address
- 内存地址ReflectiveOperationException
- 反射异常public static Object getAtt(ByteBuffer byteBuffer) throws ReflectiveOperationException
byteBuffer
- bytebuffer 对象ReflectiveOperationException
- 反射异常public static void setAttr(ByteBuffer byteBuffer, Object attr) throws ReflectiveOperationException
byteBuffer
- bytebuffer 对象attr
- 附加对象ReflectiveOperationException
- 反射异常public static void setCapacity(ByteBuffer byteBuffer, int capacity) throws ReflectiveOperationException
byteBuffer
- bytebuffer 对象capacity
- 容量ReflectiveOperationException
- 反射异常Copyright © 2020 Voovan. All rights reserved.