Package io.deephaven.base.string.cache
Class ByteArrayCharSequenceAdapterImpl
java.lang.Object
io.deephaven.base.string.cache.CharSequenceAdapter
io.deephaven.base.string.cache.ByteOrientedCharSequenceAdapter
io.deephaven.base.string.cache.ByteArrayCharSequenceAdapterImpl
- All Implemented Interfaces:
StringCompatible
,CharSequence
,Comparable<CharSequence>
See documentation in the interface and parent class for details.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionfinal char
charAt
(int index) clear()
Prepare this adapter for re-use, and eliminate references to external resources.final int
length()
set
(byte[] byteArray, int offset, int length) Set the byte array backing this CharSequenceAdapter.@NotNull CompressedString
Convert this StringCompatible into a CompressedString.@NotNull MappedCompressedString
Convert this StringCompatible into a MappedCompressedString.Methods inherited from class io.deephaven.base.string.cache.ByteOrientedCharSequenceAdapter
makeString
Methods inherited from class io.deephaven.base.string.cache.CharSequenceAdapter
compareTo, equals, hashCode, subSequence, toString
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.lang.CharSequence
chars, codePoints, isEmpty
-
Constructor Details
-
ByteArrayCharSequenceAdapterImpl
public ByteArrayCharSequenceAdapterImpl()
-
-
Method Details
-
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
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
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
Description copied from class:CharSequenceAdapter
Prepare this adapter for re-use, and eliminate references to external resources.- Specified by:
clear
in classCharSequenceAdapter
-
length
public final int length() -
charAt
public final char charAt(int index)
-