Class Utf8Array

All Implemented Interfaces:
Comparable<AbstractUtf8Array>
Direct Known Subclasses:
Identifier, Utf8PartialArray, Utf8String

public class Utf8Array extends AbstractUtf8Array
This is a primitive class that owns an array of utf8 encoded string. This is a class that has speed as its primary purpose. If you have a string, consider Utf8String If you have a large backing array consider Utf8PartialArray.
Author:
baldersheim
  • Field Details

    • utf8

      protected final byte[] utf8
  • Constructor Details

    • Utf8Array

      public Utf8Array(byte[] utf8data)
      This will simply wrap the given array assuming it is valid utf8. Note that the immutability of this primitive class depends on that the buffer is not modified after ownership has been transferred.
      Parameters:
      utf8data - The utf8 byte sequence.
    • Utf8Array

      public Utf8Array(byte[] utf8data, int offset, int length)
      This will create a new array from the window given. No validation done. Note that this will copy data. You might also want to consider Utf8PartialArray
      Parameters:
      utf8data - The base array.
      offset - The offset from where to copy from
      length - The number of bytes that should be copied.
    • Utf8Array

      public Utf8Array(ByteBuffer buf, int length)
      This will fetch length bytes from the given buffer.
      Parameters:
      buf - The ByteBuffer to read from
      length - number of bytes to read
  • Method Details