Class ByteBufferCharSequenceAdapterImpl

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

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

    • ByteBufferCharSequenceAdapterImpl

      public ByteBufferCharSequenceAdapterImpl()
  • 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 ByteBufferCharSequenceAdapterImpl set(ByteBuffer buffer, int offset, int length)
      Set the ByteBuffer backing this CharSequenceAdapter.
      Parameters:
      buffer - A ByteBuffer instance that contains a proto-String this adapter knows how to convert.
      offset - The index of the first char in buffer that belongs to the proto-String.
      length - The length of the proto-String in chars.
      Returns:
      This CharSequenceAdapter.
    • clear

      public final ByteBufferCharSequenceAdapterImpl 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)