Package io.deephaven.base.string.cache
Class CharSequenceAdapterBuilder
java.lang.Object
io.deephaven.base.string.cache.CharSequenceAdapter
io.deephaven.base.string.cache.CharSequenceAdapterBuilder
- All Implemented Interfaces:
StringCompatible,CharSequence,Comparable<CharSequence>
StringBuilder-like CharSequenceAdapter implementation.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionappend(byte value) Append a byte (converted to a char) to this adapter.append(byte[] value) append(byte[] value, int offset, int length) append(char value) Append a char to this adapter.append(char[] value) append(char[] value, int offset, int length) append(CharSequence value) Append a CharSequence to this adapter.append(CharSequence value, int offset, int length) Append a slice of a CharSequence to this adapter.Append a String to this adapter.Append a slice of a String to this adapter.final charcharAt(int index) clear()Prepare this adapter for re-use, and eliminate references to external resources.final intlength()protected final Stringfinal voidreserveCapacity(int needed) Grow the internal storage of this builder to avoid repeated resizing.@NotNull CompressedStringConvert this StringCompatible into a CompressedString.@NotNull MappedCompressedStringConvert this StringCompatible into a MappedCompressedString.Methods inherited from class io.deephaven.base.string.cache.CharSequenceAdapter
compareTo, equals, hashCode, subSequence, toStringMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.lang.CharSequence
chars, codePoints, isEmpty
-
Constructor Details
-
CharSequenceAdapterBuilder
public CharSequenceAdapterBuilder()
-
-
Method Details
-
makeString
- Specified by:
makeStringin classCharSequenceAdapter- Returns:
- A new String consistent with this CharSequenceAdapter.
-
toCompressedString
Description copied from interface:StringCompatibleConvert 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
Description copied from interface:StringCompatibleConvert 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
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
Append a String to this adapter.- Parameters:
value- A String instance to append to this adapter.- Returns:
- This adapter.
-
append
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
Append a CharSequence to this adapter.- Parameters:
value- A CharSequence instance to append to this adapter.- Returns:
- This adapter.
-
append
-
append
-
append
Append a char to this adapter.- Parameters:
value- A char to append to this adapter.- Returns:
- This adapter.
-
append
-
append
-
append
Append a byte (converted to a char) to this adapter.- Parameters:
value- A byte to append to this adapter.- Returns:
- This adapter.
-
clear
Description copied from class:CharSequenceAdapterPrepare this adapter for re-use, and eliminate references to external resources.- Specified by:
clearin classCharSequenceAdapter
-
length
public final int length() -
charAt
public final char charAt(int index)
-