public class Slice8 extends UnicodeString
Constructor and Description |
---|
Slice8(byte[] bytes,
int start,
int end)
Create a slice of an underlying byte array
|
Modifier and Type | Method and Description |
---|---|
int |
codePointAt(long index)
Get the code point at a given position in the string
|
IntIterator |
codePoints()
Get an iterator over the code points present in the string.
|
byte[] |
getByteArray() |
int |
getEnd() |
int |
getStart() |
int |
getWidth()
Get the number of bits needed to hold all the characters in this string
|
int |
hashCode()
Compute a hashCode.
|
long |
indexOf(int codePoint,
long from)
Get the position of the first occurrence of the specified codepoint,
starting the search at a given position in the string
|
long |
indexWhere(java.util.function.IntPredicate predicate,
long from)
Get the position of the first occurrence of the specified codepoint,
starting the search at a given position in the string
|
long |
length()
Get the length of the string
|
UnicodeString |
substring(long start,
long end)
Get a substring of this string, with a given start and end position
|
java.lang.String |
toString()
Display as a string.
|
asAtomic, checkSubstringBounds, compareTo, concat, economize, equals, estimatedLength, hasSubstring, indexOf, indexOf, isEmpty, length32, prefix, requireInt, substring, tidy, verifyCharacters
public Slice8(byte[] bytes, int start, int end)
bytes
- the byte array, containing Unicode codepoints in the range 0-255start
- the offset of the first character within the byte arrayend
- the offset of the first excluded byte, so the length of the string
is end-start
public long length()
UnicodeString
length
in class UnicodeString
public int getWidth()
UnicodeString
getWidth
in class UnicodeString
public byte[] getByteArray()
public int getStart()
public int getEnd()
public long indexOf(int codePoint, long from)
UnicodeString
indexOf
in class UnicodeString
codePoint
- the sought codePointfrom
- the position from which the search should start (0-based)public int codePointAt(long index)
UnicodeString
codePointAt
in class UnicodeString
index
- the given position (0-based)public UnicodeString substring(long start, long end)
UnicodeString
substring
in class UnicodeString
start
- the start position (0-based): that is, the position of the first
code point to be includedend
- the end position (0-based): specifically, the position of the first
code point not to be includedpublic long indexWhere(java.util.function.IntPredicate predicate, long from)
indexWhere
in class UnicodeString
predicate
- condition that the codepoint must satisfyfrom
- the position from which the search should start (0-based)java.lang.UnsupportedOperationException
- if the UnicodeString
has not been prepared
for codePoint accesspublic IntIterator codePoints()
UnicodeString
codePoints
in class UnicodeString
public int hashCode()
UnicodeString
use compatible hash codes and the
hashing algorithm is therefore identical to that for java.lang.String
. This means
that for strings containing Astral characters, the hash code needs to be computed by decomposing
an Astral character into a surrogate pair.hashCode
in class UnicodeString
public java.lang.String toString()
toString
in class java.lang.Object
Copyright (c) 2004-2022 Saxonica Limited. All rights reserved.