public class ResizeableByteBuffer extends Object
因ByteBuffer需实现分配长度,而保存事物到文件时是无法确定长度的,所以使用ResizeableByteBuffer 代理ByteBuffer,这里默认分配ByteBuffer 20*1024字节,当越界时在分配一个ByteBuffer,而所有的 Bytebuffer放置在一个数组中。
此对象是线程不安全的,设计时只是考虑在一个线程里使用。| 构造器和说明 |
|---|
ResizeableByteBuffer() |
| 限定符和类型 | 方法和说明 |
|---|---|
Buffer |
flip() |
ByteBuffer[] |
getByteBuffers()
获取所有的字节缓存。
|
ByteBuffer |
put(byte b) |
ByteBuffer |
put(byte[] src) |
ByteBuffer |
put(byte[] src,
int offset,
int length)
相对批量 put 方法(可选操作)。
|
ByteBuffer |
put(ByteBuffer src) |
ByteBuffer |
put(int index_,
byte b) |
ByteBuffer |
putChar(char value) |
ByteBuffer |
putChar(int index,
char value) |
ByteBuffer |
putDouble(double value) |
ByteBuffer |
putDouble(int index,
double value) |
ByteBuffer |
putFloat(float value) |
ByteBuffer |
putFloat(int index,
float value) |
ByteBuffer |
putInt(int value) |
ByteBuffer |
putInt(int index,
int value) |
ByteBuffer |
putLong(int index,
long value) |
ByteBuffer |
putLong(long value) |
ByteBuffer |
putShort(int index,
short value) |
ByteBuffer |
putShort(short value) |
public ByteBuffer[] getByteBuffers()
public Buffer flip()
public ByteBuffer put(byte b)
public ByteBuffer put(byte[] src)
public ByteBuffer put(byte[] src, int offset, int length)
src - 源offset - 偏移length - 长度public ByteBuffer put(ByteBuffer src)
public ByteBuffer put(int index_, byte b)
public ByteBuffer putChar(char value)
public ByteBuffer putChar(int index, char value)
public ByteBuffer putDouble(double value)
public ByteBuffer putDouble(int index, double value)
public ByteBuffer putFloat(float value)
public ByteBuffer putFloat(int index, float value)
public ByteBuffer putInt(int value)
public ByteBuffer putInt(int index, int value)
public ByteBuffer putLong(int index, long value)
public ByteBuffer putLong(long value)
public ByteBuffer putShort(int index, short value)
public ByteBuffer putShort(short value)
Copyright © 2016 xworker.org. All rights reserved.