Package org.apache.solr.common.util
Class ByteArrayUtf8CharSequence
- java.lang.Object
- 
- org.apache.solr.common.util.ByteArrayUtf8CharSequence
 
- 
- All Implemented Interfaces:
- CharSequence,- Cloneable,- Comparable<Utf8CharSequence>,- Utf8CharSequence
 
 public class ByteArrayUtf8CharSequence extends Object implements Utf8CharSequence A mutable byte[] backed Utf8CharSequence. This is quite similar to the BytesRef of Lucene Do not alter the contents of the byte[] . it may be inconsistent with the cached String This is designed for single-threaded use
- 
- 
Field SummaryFields Modifier and Type Field Description protected byte[]bufprotected inthashCodeprotected intlengthprotected intoffsetFunction<ByteArrayUtf8CharSequence,String>stringProviderprotected Stringutf16
 - 
Constructor SummaryConstructors Constructor Description ByteArrayUtf8CharSequence(byte[] buf, int offset, int length)ByteArrayUtf8CharSequence(String utf16)
 - 
Method SummaryAll Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static boolean_equals(byte[] a, int aFromIndex, int aToIndex, byte[] b, int bFromIndex, int bToIndex)Behaves like Java 9's Arrays.equalsbytebyteAt(int idx)charcharAt(int index)ByteArrayUtf8CharSequenceclone()static ObjectconvertCharSeq(Object o)static CollectionconvertCharSeq(Collection<?> vals)static Map.EntryconvertCharSeq(Map.Entry e)ByteArrayUtf8CharSequencedeepCopy()booleanequals(Object other)byte[]getBuf()StringgetStringOrNull()this is for internal use to get a cached string value.inthashCode()booleanisValid()Performs internal consistency checks.intlength()intoffset()ByteArrayUtf8CharSequencereset(byte[] bytes, int offset, int length, String str)intsize()The size of utf8 bytesCharSequencesubSequence(int start, int end)StringtoString()static booleanutf8Equals(Utf8CharSequence utf8_1, Utf8CharSequence utf8_2)intwrite(int start, byte[] buffer, int pos)Write the bytes into a buffer.- 
Methods inherited from class java.lang.Objectfinalize, getClass, notify, notifyAll, wait, wait, wait
 - 
Methods inherited from interface java.lang.CharSequencechars, codePoints
 - 
Methods inherited from interface org.apache.solr.common.util.Utf8CharSequencecompareTo, write
 
- 
 
- 
- 
- 
Field Detail- 
bufprotected byte[] buf 
 - 
offsetprotected int offset 
 - 
hashCodeprotected int hashCode 
 - 
lengthprotected int length 
 - 
utf16protected volatile String utf16 
 - 
stringProviderpublic Function<ByteArrayUtf8CharSequence,String> stringProvider 
 
- 
 - 
Constructor Detail- 
ByteArrayUtf8CharSequencepublic ByteArrayUtf8CharSequence(String utf16) 
 - 
ByteArrayUtf8CharSequencepublic ByteArrayUtf8CharSequence(byte[] buf, int offset, int length)
 
- 
 - 
Method Detail- 
getBufpublic byte[] getBuf() 
 - 
offsetpublic int offset() 
 - 
byteAtpublic byte byteAt(int idx) - Specified by:
- byteAtin interface- Utf8CharSequence
 
 - 
getStringOrNullpublic String getStringOrNull() this is for internal use to get a cached string value. returns null if There is no cached String value
 - 
writepublic int write(int start, byte[] buffer, int pos)Description copied from interface:Utf8CharSequenceWrite the bytes into a buffer. The objective is to avoid the local bytes being exposed to other classes if the implementation is expected to be immutable. It writes as many bytes as possible into the buffer and then return how many bytes were written. It's the responsibility of the caller to call this method repeatedly and ensure that everything is completely written- Specified by:
- writein interface- Utf8CharSequence
- Parameters:
- start- position from which to start writing
- buffer- the buffer to which to write to
- pos- position to start writing
- Returns:
- no:of bytes written
 
 - 
sizepublic int size() Description copied from interface:Utf8CharSequenceThe size of utf8 bytes- Specified by:
- sizein interface- Utf8CharSequence
- Returns:
- the size
 
 - 
lengthpublic int length() - Specified by:
- lengthin interface- CharSequence
 
 - 
utf8Equalspublic static boolean utf8Equals(Utf8CharSequence utf8_1, Utf8CharSequence utf8_2) 
 - 
charAtpublic char charAt(int index) - Specified by:
- charAtin interface- CharSequence
 
 - 
subSequencepublic CharSequence subSequence(int start, int end) - Specified by:
- subSequencein interface- CharSequence
 
 - 
clonepublic ByteArrayUtf8CharSequence clone() - Specified by:
- clonein interface- Utf8CharSequence
- Overrides:
- clonein class- Object
 
 - 
deepCopypublic ByteArrayUtf8CharSequence deepCopy() 
 - 
convertCharSeqpublic static Collection convertCharSeq(Collection<?> vals) 
 - 
toStringpublic String toString() - Specified by:
- toStringin interface- CharSequence
- Overrides:
- toStringin class- Object
 
 - 
_equalspublic static boolean _equals(byte[] a, int aFromIndex, int aToIndex, byte[] b, int bFromIndex, int bToIndex)Behaves like Java 9's Arrays.equals- See Also:
- Arrays.equals
 
 - 
resetpublic ByteArrayUtf8CharSequence reset(byte[] bytes, int offset, int length, String str) 
 - 
isValidpublic boolean isValid() Performs internal consistency checks. Always returns true (or throws IllegalStateException)
 
- 
 
-