Class CharSequenceAdapterBuilder

java.lang.Object
io.deephaven.base.string.cache.CharSequenceAdapter
io.deephaven.base.string.cache.CharSequenceAdapterBuilder
All Implemented Interfaces:
StringCompatible, CharSequence, Comparable<CharSequence>

public class CharSequenceAdapterBuilder extends CharSequenceAdapter
StringBuilder-like CharSequenceAdapter implementation.
  • Constructor Details

    • CharSequenceAdapterBuilder

      public CharSequenceAdapterBuilder()
  • Method Details

    • makeString

      protected final String makeString()
      Specified by:
      makeString in class CharSequenceAdapter
      Returns:
      A new String consistent with this CharSequenceAdapter.
    • 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).
    • reserveCapacity

      public final void reserveCapacity(int needed)
      Grow the internal storage of this builder to avoid repeated resizing.
      Parameters:
      needed -
    • append

      public final CharSequenceAdapterBuilder append(String value, int offset, int length)
      Append a slice of a String to this adapter.
      Parameters:
      value - A String instance to append to this adapter.
      offset - The index of the first char in value to include in the proto-string.
      length - The length of the proto-String in chars.
      Returns:
      This adapter.
    • append

      public final CharSequenceAdapterBuilder append(String value)
      Append a String to this adapter.
      Parameters:
      value - A String instance to append to this adapter.
      Returns:
      This adapter.
    • append

      public final CharSequenceAdapterBuilder append(CharSequence value, int offset, int length)
      Append a slice of a CharSequence to this adapter.
      Parameters:
      value - A CharSequence instance to append to this adapter.
      offset - The index of the first char in value to include in the proto-string.
      length - The length of the proto-String in chars.
      Returns:
      This adapter.
    • append

      public final CharSequenceAdapterBuilder append(CharSequence value)
      Append a CharSequence to this adapter.
      Parameters:
      value - A CharSequence instance to append to this adapter.
      Returns:
      This adapter.
    • append

      public final CharSequenceAdapterBuilder append(char[] value, int offset, int length)
    • append

      public final CharSequenceAdapterBuilder append(char[] value)
    • append

      public final CharSequenceAdapterBuilder append(char value)
      Append a char to this adapter.
      Parameters:
      value - A char to append to this adapter.
      Returns:
      This adapter.
    • append

      public final CharSequenceAdapterBuilder append(byte[] value, int offset, int length)
    • append

      public final CharSequenceAdapterBuilder append(byte[] value)
    • append

      public final CharSequenceAdapterBuilder append(byte value)
      Append a byte (converted to a char) to this adapter.
      Parameters:
      value - A byte to append to this adapter.
      Returns:
      This adapter.
    • clear

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