程序包 org.xmeta.util

类 ResizeableByteBuffer


  • public class ResizeableByteBuffer
    extends Object

    因ByteBuffer需实现分配长度,而保存事物到文件时是无法确定长度的,所以使用ResizeableByteBuffer 代理ByteBuffer,这里默认分配ByteBuffer 20*1024字节,当越界时在分配一个ByteBuffer,而所有的 Bytebuffer放置在一个数组中。

    此对象是线程不安全的,设计时只是考虑在一个线程里使用。
    作者:
    zyx
    • 构造器详细资料

      • ResizeableByteBuffer

        public ResizeableByteBuffer()
    • 方法详细资料

      • getByteBuffers

        public ByteBuffer[] getByteBuffers()
        获取所有的字节缓存。
        返回:
        缓存列表
      • put

        public ByteBuffer put​(byte[] src,
                              int offset,
                              int length)
        相对批量 put 方法(可选操作)。
        参数:
        src - 源
        offset - 偏移
        length - 长度
        返回:
        结果。
      • 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)