Package io.deephaven.base.string.cache
Class ByteBufferCharSequenceAdapterImpl
java.lang.Object
io.deephaven.base.string.cache.CharSequenceAdapter
io.deephaven.base.string.cache.ByteOrientedCharSequenceAdapter
io.deephaven.base.string.cache.ByteBufferCharSequenceAdapterImpl
- All Implemented Interfaces:
StringCompatible,CharSequence,Comparable<CharSequence>
See documentation in the interface and parent class for details.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal charcharAt(int index) clear()Prepare this adapter for re-use, and eliminate references to external resources.final intlength()set(ByteBuffer buffer, int offset, int length) Set the ByteBuffer backing this CharSequenceAdapter.@NotNull CompressedStringConvert this StringCompatible into a CompressedString.@NotNull MappedCompressedStringConvert this StringCompatible into a MappedCompressedString.Methods inherited from class io.deephaven.base.string.cache.ByteOrientedCharSequenceAdapter
makeStringMethods 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
-
ByteBufferCharSequenceAdapterImpl
public ByteBufferCharSequenceAdapterImpl()
-
-
Method Details
-
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).
-
set
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
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)
-