类 SegmentedGrowableMemoryByteArray

java.lang.Object
com.google.typography.font.sfntly.data.ByteArray<SegmentedGrowableMemoryByteArray>
com.google.typography.font.sfntly.data.SegmentedGrowableMemoryByteArray

final class SegmentedGrowableMemoryByteArray extends ByteArray<SegmentedGrowableMemoryByteArray>
A growable memory implementation of the ByteArray interface.
作者:
Stuart Gill
  • 字段详细资料

    • DEFAULT_BUFFER_LOW_BITS

      private static final int DEFAULT_BUFFER_LOW_BITS
      另请参阅:
    • buffers

      private List<byte[]> buffers
    • lowBits

      private final int lowBits
  • 构造器详细资料

    • SegmentedGrowableMemoryByteArray

      public SegmentedGrowableMemoryByteArray()
      Constructor.
    • SegmentedGrowableMemoryByteArray

      public SegmentedGrowableMemoryByteArray(int lowBits)
      Constructor. The low bits parameter is used to set the initial size of the first chained memory buffer used internally. That initial buffer is 2^(low bits) in size and each subsequent buffer is roughly double the preceding one. If this is too small then there will be a number of small buffers and the cost of access will increase. If it's too large then there will a lot of allocated but unused space.
      参数:
      lowBits - the number of bits to use as the initial buffer index
      抛出:
      IndexOutOfBoundsException - if the given bounds don't fit within the byte array given
  • 方法详细资料

    • internalPut

      protected void internalPut(int index, byte b)
      从类复制的说明: ByteArray
      Stores the byte at the index given.
      指定者:
      internalPut 在类中 ByteArray<SegmentedGrowableMemoryByteArray>
      参数:
      index - the location to store at
      b - the byte to store
    • internalPut

      protected int internalPut(int index, byte[] b, int offset, int length)
      从类复制的说明: ByteArray
      Stores the array of bytes at the given index.
      指定者:
      internalPut 在类中 ByteArray<SegmentedGrowableMemoryByteArray>
      参数:
      index - the location to store at
      b - the bytes to store
      offset - the offset to start from in the byte array
      length - the length of the byte array to store from the offset
      返回:
      the number of bytes actually stored
    • internalGet

      protected int internalGet(int index)
      从类复制的说明: ByteArray
      Gets the byte at the index given.
      指定者:
      internalGet 在类中 ByteArray<SegmentedGrowableMemoryByteArray>
      参数:
      index - the location to get from
      返回:
      the byte stored at the index
    • internalGet

      protected int internalGet(int index, byte[] b, int offset, int length)
      从类复制的说明: ByteArray
      Gets the bytes at the index given of the given length.
      指定者:
      internalGet 在类中 ByteArray<SegmentedGrowableMemoryByteArray>
      参数:
      index - the location to start getting from
      b - the array to put the bytes into
      offset - the offset in the array to put the bytes into
      length - the length of bytes to read
      返回:
      the number of bytes actually ready
    • close

      public void close()
      从类复制的说明: ByteArray
      Close this instance of the ByteArray.
      指定者:
      close 在类中 ByteArray<SegmentedGrowableMemoryByteArray>
    • bufferOffset

      private int bufferOffset(int bufferIndex, int index)
      Calculate the offset within a given buffer from the buffer index and the overall index in the overall "virtual" buffer.
      参数:
      bufferIndex - the index of the buffer where the data is found
      index - the index into the overall "virtual" buffer
      返回:
      the offset in the buffer
      另请参阅:
    • bufferIndex

      private int bufferIndex(int index)
      Calculate the buffer index from the index in the overall "virtual" buffer.
      参数:
      index - the index into the overall "virtual" buffer
      返回:
      the buffer index
      另请参阅:
    • buffer

      private byte[] buffer(int index)
      Get the buffer at the buffer index specified. If the buffer has not previously been allocated then it is allocated. Any buffers between this buffer and the last previously allocated buffer are also allocated.
      参数:
      index - the buffer index
      返回:
      the buffer specified