Class ByteArrayCharSequenceAdapterImpl

All Implemented Interfaces:
StringCompatible, CharSequence, Comparable<CharSequence>

public class ByteArrayCharSequenceAdapterImpl extends ByteOrientedCharSequenceAdapter
See documentation in the interface and parent class for details.
  • Constructor Details

    • ByteArrayCharSequenceAdapterImpl

      public ByteArrayCharSequenceAdapterImpl()
  • Method Details

    • toCompressedString

      @NotNull public @NotNull CompressedString toCompressedString()
      Description copied from interface: StringCompatible
      Convert this StringCompatible into a CompressedString. Implementations should not cache result CompressedStrings, in order to avoid inadvertently allowing promotion of short-lived objects under generational garbage collection.
      Returns:
      A newly constructed CompressedString representing the same sequence of characters as this StringCompatible (or this object, if appropriate).
    • toMappedCompressedString

      @NotNull public @NotNull MappedCompressedString toMappedCompressedString()
      Description copied from interface: StringCompatible
      Convert this StringCompatible into a MappedCompressedString. Implementations should not cache result CompressedStrings, in order to avoid inadvertently allowing promotion of short-lived objects under generational garbage collection.
      Returns:
      A newly constructed MappedCompressedString representing the same sequence of characters as this StringCompatible (or this object, if appropriate).
    • set

      public final ByteArrayCharSequenceAdapterImpl set(byte[] byteArray, int offset, int length)
      Set the byte array backing this CharSequenceAdapter.
      Parameters:
      byteArray - A byte[] instance that contains a proto-String this adapter knows how to convert.
      offset - The index of the first char in byteArray that belongs to the proto-String.
      length - The length of the proto-String in chars.
      Returns:
      This CharSequenceAdapter.
    • clear

      public final ByteArrayCharSequenceAdapterImpl clear()
      Description copied from class: CharSequenceAdapter
      Prepare this adapter for re-use, and eliminate references to external resources.
      Specified by:
      clear in class CharSequenceAdapter
    • length

      public final int length()
    • charAt

      public final char charAt(int index)