程序包 org.xmeta.util
类 ResizeableByteBuffer
- java.lang.Object
-
- org.xmeta.util.ResizeableByteBuffer
-
public class ResizeableByteBuffer extends Object
因ByteBuffer需实现分配长度,而保存事物到文件时是无法确定长度的,所以使用ResizeableByteBuffer 代理ByteBuffer,这里默认分配ByteBuffer 20*1024字节,当越界时在分配一个ByteBuffer,而所有的 Bytebuffer放置在一个数组中。
此对象是线程不安全的,设计时只是考虑在一个线程里使用。- 作者:
- zyx
-
-
构造器概要
构造器 构造器 说明 ResizeableByteBuffer()
-
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 Bufferflip()ByteBuffer[]getByteBuffers()获取所有的字节缓存。ByteBufferput(byte b)ByteBufferput(byte[] src)ByteBufferput(byte[] src, int offset, int length)相对批量 put 方法(可选操作)。ByteBufferput(int index_, byte b)ByteBufferput(ByteBuffer src)ByteBufferputChar(char value)ByteBufferputChar(int index, char value)ByteBufferputDouble(double value)ByteBufferputDouble(int index, double value)ByteBufferputFloat(float value)ByteBufferputFloat(int index, float value)ByteBufferputInt(int value)ByteBufferputInt(int index, int value)ByteBufferputLong(int index, long value)ByteBufferputLong(long value)ByteBufferputShort(int index, short value)ByteBufferputShort(short value)
-
-
-
方法详细资料
-
getByteBuffers
public ByteBuffer[] getByteBuffers()
获取所有的字节缓存。- 返回:
- 缓存列表
-
flip
public Buffer flip()
-
put
public ByteBuffer put(byte b)
-
put
public ByteBuffer put(byte[] src)
-
put
public ByteBuffer put(byte[] src, int offset, int length)
相对批量 put 方法(可选操作)。- 参数:
src- 源offset- 偏移length- 长度- 返回:
- 结果。
-
put
public ByteBuffer put(ByteBuffer src)
-
put
public ByteBuffer put(int index_, byte b)
-
putChar
public ByteBuffer putChar(char value)
-
putChar
public ByteBuffer putChar(int index, char value)
-
putDouble
public ByteBuffer putDouble(double value)
-
putDouble
public ByteBuffer putDouble(int index, double value)
-
putFloat
public ByteBuffer putFloat(float value)
-
putFloat
public ByteBuffer putFloat(int index, float value)
-
putInt
public ByteBuffer putInt(int value)
-
putInt
public ByteBuffer putInt(int index, int value)
-
putLong
public ByteBuffer putLong(int index, long value)
-
putLong
public ByteBuffer putLong(long value)
-
putShort
public ByteBuffer putShort(int index, short value)
-
putShort
public ByteBuffer putShort(short value)
-
-