APIdia Launch Partner
Top Description Inners Constructors Methods
java.lang

pack-priv final Class StringLatin1

extends Object
Class Inheritance
Imports
java.util.Arrays, .Locale, .Objects, .Spliterator, java.util.function.Consumer, .IntConsumer, java.util.stream.Stream, .StreamSupport, jdk.internal.lang.CaseFolding, jdk.internal.util.ArraysSupport, jdk.internal.vm.annotation.IntrinsicCandidate

Latin-1 string operations.

Unless stated otherwise, all methods assume that

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv static class
private static class

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
pack-priv static boolean
canEncode(char cp)

pack-priv static boolean
canEncode(int cp)

pack-priv static char
charAt(byte[] value, int index)

pack-priv static byte
coderFromChar(char cp)

pack-priv static int

Returns:

0 if value is equal to other, a value less than 0 if value is lexicographically less than other; a value greater than 0 otherwise.
compareTo
(byte[]
a Latin-1 string byte array
value
,
byte[]
a Latin-1 string byte array
other
)

Lexicographically compares two Latin-1 strings as specified in String::compareTo.

pack-priv static int

Returns:

0 if the value prefix is equal to the other prefix, a value less than 0 if the value prefix is lexicographically less than the other prefix; a value greater than 0 otherwise.
compareTo
(byte[]
a Latin-1 string byte array
value
,
byte[]
a Latin-1 string byte array
other
,
int
the number of characters in value to compare
len1
,
int
the number of characters in other to compare
len2
)

Lexicographically compares two Latin-1 string prefixes as specified in String::compareTo.

private static int
compareTo0(byte[] value, byte[] other)

pack-priv static int
compareToCI(byte[] value, byte[] other)

Case-insensitive compareTo.

pack-priv static int
compareToCI_UTF16(byte[] value, byte[] other)

Case-insensitive compareToUTF16.

pack-priv static int
compareToFC(byte[] value, byte[] other)

private static int
compareToFC0(byte[] value, int off, int last, byte[] other, int ooff, int olast)

private static int
compareToFC0_UTF16(byte[] value, int off, int last, byte[] other, int ooff, int olast)

pack-priv static int
compareToFC_UTF16(byte[] value, byte[] other)

pack-priv static int

Returns:

0 if the value is equal to the other, a value less than 0 if the value is lexicographically less than the other; a value greater than 0 otherwise.
compareToUTF16
(byte[]
a Latin-1 string byte array
value
,
byte[]
a UTF-16 string byte array
other
)

Lexicographically compares a Latin-1 string to a UTF-16 string as specified in String::compareTo.

pack-priv static int
compareToUTF16(byte[]
a Latin-1 string byte array
value
,
byte[]
a UTF-16 string byte array
other
,
int
the number of characters in value to compare
len1
,
int
the number of characters in other to compare
len2
)

Lexicographically compares a Latin-1 string prefix to a UTF-16 one as specified in String::compareTo.

private static int
compareToUTF16_0(byte[] value, byte[] other)

private static int
compareToUTF16Values(byte[] value, byte[] other, int len1, int len2)

pack-priv static boolean

Returns:

true if provided byte arrays contain identical content; false otherwise
equals
(byte[]
a byte array
value
,
byte[]
a byte array
other
)

Returns true if provided byte arrays contain identical content; false otherwise.

private static boolean
equals0(byte[] value, byte[] other)

pack-priv static void
getBytes(byte[] value, int srcBegin, int srcEnd, byte[] dst, int dstBegin)

pack-priv static char
getChar(byte[] val, int index)

pack-priv static void
getChars(byte[] value, int srcBegin, int srcEnd, char[] dst, int dstBegin)

pack-priv static int
hashCode(byte[] value)

pack-priv static int

Returns:

the index of the first character matching the provided one in the given target string sub-range; -1 otherwise
indexOf
(byte[]
a Latin-1 string byte array to search in
value
,
int
a character to search for
ch
,
int
the index (inclusive) of the first character in the sub-range
fromIndex
,
int
the index (exclusive) of the last character in the sub-range
toIndex
)

Finds the index of the first character matching the provided one in the given Latin-1 string byte array sub-range.

pack-priv static int

Returns:

the index of the first character of the matching value sub-range if a match is found; -1 otherwise
indexOf
(byte[]
a Latin-1 string byte array to search in
value
,
byte[]
a Latin-1 string byte array to search for
str
)

Searches for the first occurrence of str in value, and, if found, returns the index of the first character of the matching value sub-range; -1 otherwise.

pack-priv static int

Returns:

the index of the first character of the matching value sub-range if a match is found; -1 otherwise
indexOf
(byte[]
a Latin-1 string byte array to search in
value
,
int
the index (exclusive) of the last character in value
valueToIndex
,
byte[]
a Latin-1 string byte array to search for
str
,
int
the index (exclusive) of the last character in str
strToIndex
,
int
the index (inclusive) of the first character in value
valueFromIndex
)

Searches for the first occurrence of the given str sub-range in the given value sub-range, and, if found, returns the index of the first character of the matching value sub-range; -1 otherwise.

private static int
indexOf0(byte[] value, byte[] str)

private static int
indexOf0(byte[] value, int valueToIndex, byte[] str, int strToIndex, int valueFromIndex)

private static int
indexOfChar0(byte[] value, int ch, int fromIndex, int max)

pack-priv static int
indexOfNonWhitespace(byte[] value)

pack-priv static byte[]
inflate(byte[] value, int off, int len)

pack-priv static void
inflate(byte[]
the source Latin-1 string byte array
src
,
int
the index (inclusive) of the first character in src
srcOff
,
char[]
the target char array
dst
,
int
the index (inclusive) of the first character in dst
dstOff
,
int
the maximum number of characters to copy
len
)

Copies characters from a Latin-1 string byte array sub-range to the given char array sub-range.

pack-priv static void
inflate(byte[]
the source Latin-1 string byte array
src
,
int
the index (inclusive) of the first character in src
srcOff
,
byte[]
the target UTF-16 string byte array
dst
,
int
the index (inclusive) of the first character in dst
dstOff
,
int
the maximum number of characters to copy
len
)

Copies characters from a Latin-1 string byte array sub-range to a UTF-16 one.

private static void
inflate0(byte[] src, int srcOff, char[] dst, int dstOff, int len)

private static void
inflate0(byte[] src, int srcOff, byte[] dst, int dstOff, int len)

pack-priv static int
lastIndexOf(byte[] src, int srcCount, byte[] tgt, int tgtCount, int fromIndex)

pack-priv static int
lastIndexOf(final byte[] value, int ch, int fromIndex)

pack-priv static int
pack-priv static int
length(byte[] value)

pack-priv static Stream<String>
lines(byte[] value)

pack-priv static String
newString(byte[] val, int index, int len)

pack-priv static void
putCharsAt(byte[] value, int i, char c1, char c2, char c3, char c4)

pack-priv static void
putCharsAt(byte[] value, int i, char c1, char c2, char c3, char c4, char c5)

pack-priv static boolean
regionMatchesCI(byte[] value, int toffset, byte[] other, int ooffset, int len)

pack-priv static boolean
regionMatchesCI_UTF16(byte[] value, int toffset, byte[] other, int ooffset, int len)

pack-priv static String
replace(byte[] value, char oldChar, char newChar)

pack-priv static String
replace(byte[] value, int valLen, byte[] targ, int targLen, byte[] repl, int replLen)

pack-priv static String
strip(byte[] value)

pack-priv static String
stripLeading(byte[] value)

pack-priv static String
stripTrailing(byte[] value)

pack-priv static byte[]
toBytes(char c)

pack-priv static char[]
toChars(byte[] value)

pack-priv static String
toLowerCase(String str, byte[] value, Locale locale)

private static String
toLowerCaseEx(String str, byte[] value, int first, Locale locale, boolean localeDependent)

pack-priv static String
toUpperCase(String str, byte[] value, Locale locale)

private static String
toUpperCaseEx(String str, byte[] value, int first, Locale locale, boolean localeDependent)

pack-priv static String
trim(byte[] value)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

StringLatin1back to summary
pack-priv StringLatin1()

Method Detail

canEncodeback to summary
pack-priv static boolean canEncode(char cp)
canEncodeback to summary
pack-priv static boolean canEncode(int cp)
charAtback to summary
pack-priv static char charAt(byte[] value, int index)
coderFromCharback to summary
pack-priv static byte coderFromChar(char cp)
compareToback to summary
pack-priv static int compareTo(byte[] value, byte[] other)

Lexicographically compares two Latin-1 strings as specified in String::compareTo.

Parameters
value:byte[]

a Latin-1 string byte array

other:byte[]

a Latin-1 string byte array

Returns:int

0 if value is equal to other, a value less than 0 if value is lexicographically less than other; a value greater than 0 otherwise.

Exceptions
NullPointerException:
if value or other is null
compareToback to summary
pack-priv static int compareTo(byte[] value, byte[] other, int len1, int len2)

Lexicographically compares two Latin-1 string prefixes as specified in String::compareTo.

Parameters
value:byte[]

a Latin-1 string byte array

other:byte[]

a Latin-1 string byte array

len1:int

the number of characters in value to compare

len2:int

the number of characters in other to compare

Returns:int

0 if the value prefix is equal to the other prefix, a value less than 0 if the value prefix is lexicographically less than the other prefix; a value greater than 0 otherwise.

Exceptions
NullPointerException:
if value or other is null
StringIndexOutOfBoundsException:
if the sub-ranges are out of bounds
compareTo0back to summary
private static int compareTo0(byte[] value, byte[] other)
Annotations
@IntrinsicCandidate
compareToCIback to summary
pack-priv static int compareToCI(byte[] value, byte[] other)

Case-insensitive compareTo.

compareToCI_UTF16back to summary
pack-priv static int compareToCI_UTF16(byte[] value, byte[] other)

Case-insensitive compareToUTF16.

compareToFCback to summary
pack-priv static int compareToFC(byte[] value, byte[] other)
compareToFC0back to summary
private static int compareToFC0(byte[] value, int off, int last, byte[] other, int ooff, int olast)
compareToFC0_UTF16back to summary
private static int compareToFC0_UTF16(byte[] value, int off, int last, byte[] other, int ooff, int olast)
compareToFC_UTF16back to summary
pack-priv static int compareToFC_UTF16(byte[] value, byte[] other)
compareToUTF16back to summary
pack-priv static int compareToUTF16(byte[] value, byte[] other)

Lexicographically compares a Latin-1 string to a UTF-16 string as specified in String::compareTo.

Parameters
value:byte[]

a Latin-1 string byte array

other:byte[]

a UTF-16 string byte array

Returns:int

0 if the value is equal to the other, a value less than 0 if the value is lexicographically less than the other; a value greater than 0 otherwise.

Exceptions
NullPointerException:
if value or other is null
compareToUTF16back to summary
pack-priv static int compareToUTF16(byte[] value, byte[] other, int len1, int len2)

Lexicographically compares a Latin-1 string prefix to a UTF-16 one as specified in String::compareTo.

Parameters
value:byte[]

a Latin-1 string byte array

other:byte[]

a UTF-16 string byte array

len1:int

the number of characters in value to compare

len2:int

the number of characters in other to compare

Exceptions
NullPointerException:
if value or other is null
StringIndexOutOfBoundsException:
if the sub-ranges are out of bounds
compareToUTF16_0back to summary
private static int compareToUTF16_0(byte[] value, byte[] other)
Annotations
@IntrinsicCandidate
compareToUTF16Valuesback to summary
private static int compareToUTF16Values(byte[] value, byte[] other, int len1, int len2)
equalsback to summary
pack-priv static boolean equals(byte[] value, byte[] other)

Returns true if provided byte arrays contain identical content; false otherwise. .

Parameters
value:byte[]

a byte array

other:byte[]

a byte array

Returns:boolean

true if provided byte arrays contain identical content; false otherwise

Exceptions
NullPointerException:
if value or other is null
equals0back to summary
private static boolean equals0(byte[] value, byte[] other)
Annotations
@IntrinsicCandidate
getBytesback to summary
pack-priv static void getBytes(byte[] value, int srcBegin, int srcEnd, byte[] dst, int dstBegin)
getCharback to summary
pack-priv static char getChar(byte[] val, int index)
getCharsback to summary
pack-priv static void getChars(byte[] value, int srcBegin, int srcEnd, char[] dst, int dstBegin)
hashCodeback to summary
pack-priv static int hashCode(byte[] value)
indexOfback to summary
pack-priv static int indexOf(byte[] value, int ch, int fromIndex, int toIndex)

Finds the index of the first character matching the provided one in the given Latin-1 string byte array sub-range. -1 is returned if the provided character cannot be encoded in Latin-1, or cannot be found in the target string sub-range.

Parameters
value:byte[]

a Latin-1 string byte array to search in

ch:int

a character to search for

fromIndex:int

the index (inclusive) of the first character in the sub-range

toIndex:int

the index (exclusive) of the last character in the sub-range

Returns:int

the index of the first character matching the provided one in the given target string sub-range; -1 otherwise

Exceptions
NullPointerException:
if value is null
StringIndexOutOfBoundsException:
if the sub-range is out of bounds
indexOfback to summary
pack-priv static int indexOf(byte[] value, byte[] str)

Searches for the first occurrence of str in value, and, if found, returns the index of the first character of the matching value sub-range; -1 otherwise.

Parameters
value:byte[]

a Latin-1 string byte array to search in

str:byte[]

a Latin-1 string byte array to search for

Returns:int

the index of the first character of the matching value sub-range if a match is found; -1 otherwise

Exceptions
NullPointerException:
if value or str is null
indexOfback to summary
pack-priv static int indexOf(byte[] value, int valueToIndex, byte[] str, int strToIndex, int valueFromIndex)

Searches for the first occurrence of the given str sub-range in the given value sub-range, and, if found, returns the index of the first character of the matching value sub-range; -1 otherwise.

Parameters
value:byte[]

a Latin-1 string byte array to search in

valueToIndex:int

the index (exclusive) of the last character in value

str:byte[]

a Latin-1 string byte array to search for

strToIndex:int

the index (exclusive) of the last character in str

valueFromIndex:int

the index (inclusive) of the first character in value

Returns:int

the index of the first character of the matching value sub-range if a match is found; -1 otherwise

Exceptions
NullPointerException:
if value or str is null
StringIndexOutOfBoundsException:
if the sub-ranges are out of bounds
indexOf0back to summary
private static int indexOf0(byte[] value, byte[] str)
Annotations
@IntrinsicCandidate
indexOf0back to summary
private static int indexOf0(byte[] value, int valueToIndex, byte[] str, int strToIndex, int valueFromIndex)
Annotations
@IntrinsicCandidate
indexOfChar0back to summary
private static int indexOfChar0(byte[] value, int ch, int fromIndex, int max)
Annotations
@IntrinsicCandidate
indexOfNonWhitespaceback to summary
pack-priv static int indexOfNonWhitespace(byte[] value)
inflateback to summary
pack-priv static byte[] inflate(byte[] value, int off, int len)
inflateback to summary
pack-priv static void inflate(byte[] src, int srcOff, char[] dst, int dstOff, int len)

Copies characters from a Latin-1 string byte array sub-range to the given char array sub-range.

This effectively inflates the content from a 1 byte per character representation to a 2 byte one.

Parameters
src:byte[]

the source Latin-1 string byte array

srcOff:int

the index (inclusive) of the first character in src

dst:char[]

the target char array

dstOff:int

the index (inclusive) of the first character in dst

len:int

the maximum number of characters to copy

Exceptions
NullPointerException:
if src or dst is null
StringIndexOutOfBoundsException:
if the sub-ranges are out of bounds
inflateback to summary
pack-priv static void inflate(byte[] src, int srcOff, byte[] dst, int dstOff, int len)

Copies characters from a Latin-1 string byte array sub-range to a UTF-16 one.

This effectively inflates the content from a 1 byte per character representation to a 2 byte one.

Parameters
src:byte[]

the source Latin-1 string byte array

srcOff:int

the index (inclusive) of the first character in src

dst:byte[]

the target UTF-16 string byte array

dstOff:int

the index (inclusive) of the first character in dst

len:int

the maximum number of characters to copy

Exceptions
NullPointerException:
if src or dst is null
StringIndexOutOfBoundsException:
if the sub-ranges are out of bounds
inflate0back to summary
private static void inflate0(byte[] src, int srcOff, char[] dst, int dstOff, int len)
Annotations
@IntrinsicCandidate
inflate0back to summary
private static void inflate0(byte[] src, int srcOff, byte[] dst, int dstOff, int len)
Annotations
@IntrinsicCandidate
lastIndexOfback to summary
pack-priv static int lastIndexOf(byte[] src, int srcCount, byte[] tgt, int tgtCount, int fromIndex)
lastIndexOfback to summary
pack-priv static int lastIndexOf(final byte[] value, int ch, int fromIndex)
lastIndexOfNonWhitespaceback to summary
pack-priv static int lastIndexOfNonWhitespace(byte[] value)
lengthback to summary
pack-priv static int length(byte[] value)
linesback to summary
pack-priv static Stream<String> lines(byte[] value)
newStringback to summary
pack-priv static String newString(byte[] val, int index, int len)
putCharsAtback to summary
pack-priv static void putCharsAt(byte[] value, int i, char c1, char c2, char c3, char c4)
putCharsAtback to summary
pack-priv static void putCharsAt(byte[] value, int i, char c1, char c2, char c3, char c4, char c5)
regionMatchesCIback to summary
pack-priv static boolean regionMatchesCI(byte[] value, int toffset, byte[] other, int ooffset, int len)
regionMatchesCI_UTF16back to summary
pack-priv static boolean regionMatchesCI_UTF16(byte[] value, int toffset, byte[] other, int ooffset, int len)
replaceback to summary
pack-priv static String replace(byte[] value, char oldChar, char newChar)
replaceback to summary
pack-priv static String replace(byte[] value, int valLen, byte[] targ, int targLen, byte[] repl, int replLen)
stripback to summary
pack-priv static String strip(byte[] value)
stripLeadingback to summary
pack-priv static String stripLeading(byte[] value)
stripTrailingback to summary
pack-priv static String stripTrailing(byte[] value)
toBytesback to summary
pack-priv static byte[] toBytes(char c)
toCharsback to summary
pack-priv static char[] toChars(byte[] value)
toLowerCaseback to summary
pack-priv static String toLowerCase(String str, byte[] value, Locale locale)
toLowerCaseExback to summary
private static String toLowerCaseEx(String str, byte[] value, int first, Locale locale, boolean localeDependent)
toUpperCaseback to summary
pack-priv static String toUpperCase(String str, byte[] value, Locale locale)
toUpperCaseExback to summary
private static String toUpperCaseEx(String str, byte[] value, int first, Locale locale, boolean localeDependent)
trimback to summary
pack-priv static String trim(byte[] value)
java.lang back to summary

pack-priv Class StringLatin1.CharsSpliterator

extends Object
implements OfInt
Class Inheritance
All Implemented Interfaces
java.util.Spliterator.OfInt, java.util.Spliterator.OfPrimitive, java.util.Spliterator

Field Summary

Modifier and TypeField and Description
private final byte[]
private final int
private final int
private int

Constructor Summary

AccessConstructor and Description
pack-priv
CharsSpliterator(byte[] array, int acs)

pack-priv
CharsSpliterator(byte[] array, int origin, int fence, int acs)

Method Summary

Modifier and TypeMethod and Description
public int
characteristics()

Implements java.util.Spliterator.characteristics.

Returns a set of characteristics of this Spliterator and its elements.

public long
estimateSize()

Implements java.util.Spliterator.estimateSize.

Returns an estimate of the number of elements that would be encountered by a forEachRemaining traversal, or returns Long#MAX_VALUE if infinite, unknown, or too expensive to compute.

public void
forEachRemaining(IntConsumer action)

Overrides default java.util.Spliterator.OfInt.forEachRemaining.

Performs the given action for each remaining element, sequentially in the current thread, until all elements have been processed or the action throws an exception.

public boolean
tryAdvance(IntConsumer action)

Implements java.util.Spliterator.OfInt.tryAdvance.

If a remaining element exists, performs the given action on it, returning true; else returns false.

public Spliterator.OfInt
trySplit()

Implements java.util.Spliterator.OfInt.trySplit.

If this spliterator can be partitioned, returns a Spliterator covering elements, that will, upon return from this method, not be covered by this Spliterator.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

arrayback to summary
private final byte[] array
csback to summary
private final int cs
fenceback to summary
private final int fence
indexback to summary
private int index

Constructor Detail

CharsSpliteratorback to summary
pack-priv CharsSpliterator(byte[] array, int acs)
CharsSpliteratorback to summary
pack-priv CharsSpliterator(byte[] array, int origin, int fence, int acs)

Method Detail

characteristicsback to summary
public int characteristics()

Implements java.util.Spliterator.characteristics.

Doc from java.util.Spliterator.characteristics.

Returns a set of characteristics of this Spliterator and its elements. The result is represented as ORed values from ORDERED, DISTINCT, SORTED, SIZED, NONNULL, IMMUTABLE, CONCURRENT, SUBSIZED. Repeated calls to characteristics() on a given spliterator, prior to or in-between calls to trySplit, should always return the same result.

If a Spliterator reports an inconsistent set of characteristics (either those returned from a single invocation or across multiple invocations), no guarantees can be made about any computation using this Spliterator.

Annotations
@Override
estimateSizeback to summary
public long estimateSize()

Implements java.util.Spliterator.estimateSize.

Doc from java.util.Spliterator.estimateSize.

Returns an estimate of the number of elements that would be encountered by a forEachRemaining traversal, or returns Long#MAX_VALUE if infinite, unknown, or too expensive to compute.

If this Spliterator is SIZED and has not yet been partially traversed or split, or this Spliterator is SUBSIZED and has not yet been partially traversed, this estimate must be an accurate count of elements that would be encountered by a complete traversal. Otherwise, this estimate may be arbitrarily inaccurate, but must decrease as specified across invocations of trySplit.

Annotations
@Override
forEachRemainingback to summary
public void forEachRemaining(IntConsumer action)

Overrides default java.util.Spliterator.OfInt.forEachRemaining.

Doc from java.util.Spliterator.OfPrimitive.forEachRemaining.

Performs the given action for each remaining element, sequentially in the current thread, until all elements have been processed or the action throws an exception. If this Spliterator is ORDERED, actions are performed in encounter order. Exceptions thrown by the action are relayed to the caller.

Subsequent behavior of a spliterator is unspecified if the action throws an exception.

Annotations
@Override
tryAdvanceback to summary
public boolean tryAdvance(IntConsumer action)

Implements java.util.Spliterator.OfInt.tryAdvance.

Doc from java.util.Spliterator.OfPrimitive.tryAdvance.

If a remaining element exists, performs the given action on it, returning true; else returns false. If this Spliterator is ORDERED the action is performed on the next element in encounter order. Exceptions thrown by the action are relayed to the caller.

Subsequent behavior of a spliterator is unspecified if the action throws an exception.

Annotations
@Override
trySplitback to summary
public Spliterator.OfInt trySplit()

Implements java.util.Spliterator.OfInt.trySplit.

Doc from java.util.Spliterator.trySplit.

If this spliterator can be partitioned, returns a Spliterator covering elements, that will, upon return from this method, not be covered by this Spliterator.

If this Spliterator is ORDERED, the returned Spliterator must cover a strict prefix of the elements.

Unless this Spliterator covers an infinite number of elements, repeated calls to trySplit() must eventually return null. Upon non-null return:

  • the value reported for estimateSize() before splitting, must, after splitting, be greater than or equal to estimateSize() for this and the returned Spliterator; and
  • if this Spliterator is SUBSIZED, then estimateSize() for this spliterator before splitting must be equal to the sum of estimateSize() for this and the returned Spliterator after splitting.

This method may return null for any reason, including emptiness, inability to split after traversal has commenced, data structure constraints, and efficiency considerations.

Annotations
@Override
java.lang back to summary

private final Class StringLatin1.LinesSpliterator

extends Object
implements Spliterator<String>
Class Inheritance
All Implemented Interfaces
java.util.Spliterator

Field Summary

Modifier and TypeField and Description
private final int
private int
private byte[]

Constructor Summary

AccessConstructor and Description
private
LinesSpliterator(byte[] value, int start, int length)

Method Summary

Modifier and TypeMethod and Description
public int
characteristics()

Implements java.util.Spliterator.characteristics.

Returns a set of characteristics of this Spliterator and its elements.

public long
estimateSize()

Implements java.util.Spliterator.estimateSize.

Returns an estimate of the number of elements that would be encountered by a forEachRemaining traversal, or returns Long#MAX_VALUE if infinite, unknown, or too expensive to compute.

public void
forEachRemaining(Consumer<? super String> action)

Overrides default java.util.Spliterator.forEachRemaining.

Performs the given action for each remaining element, sequentially in the current thread, until all elements have been processed or the action throws an exception.

private int
private String
next()

private int
skipLineSeparator(int start)

pack-priv static StringLatin1.LinesSpliterator
spliterator(byte[] value)

public boolean
tryAdvance(Consumer<? super String> action)

Implements java.util.Spliterator.tryAdvance.

If a remaining element exists: performs the given action on it, returning true; else returns false.

public Spliterator<String>
trySplit()

Implements java.util.Spliterator.trySplit.

If this spliterator can be partitioned, returns a Spliterator covering elements, that will, upon return from this method, not be covered by this Spliterator.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

fenceback to summary
private final int fence
indexback to summary
private int index
valueback to summary
private byte[] value

Constructor Detail

LinesSpliteratorback to summary
private LinesSpliterator(byte[] value, int start, int length)

Method Detail

characteristicsback to summary
public int characteristics()

Implements java.util.Spliterator.characteristics.

Doc from java.util.Spliterator.characteristics.

Returns a set of characteristics of this Spliterator and its elements. The result is represented as ORed values from ORDERED, DISTINCT, SORTED, SIZED, NONNULL, IMMUTABLE, CONCURRENT, SUBSIZED. Repeated calls to characteristics() on a given spliterator, prior to or in-between calls to trySplit, should always return the same result.

If a Spliterator reports an inconsistent set of characteristics (either those returned from a single invocation or across multiple invocations), no guarantees can be made about any computation using this Spliterator.

Annotations
@Override
estimateSizeback to summary
public long estimateSize()

Implements java.util.Spliterator.estimateSize.

Doc from java.util.Spliterator.estimateSize.

Returns an estimate of the number of elements that would be encountered by a forEachRemaining traversal, or returns Long#MAX_VALUE if infinite, unknown, or too expensive to compute.

If this Spliterator is SIZED and has not yet been partially traversed or split, or this Spliterator is SUBSIZED and has not yet been partially traversed, this estimate must be an accurate count of elements that would be encountered by a complete traversal. Otherwise, this estimate may be arbitrarily inaccurate, but must decrease as specified across invocations of trySplit.

Annotations
@Override
forEachRemainingback to summary
public void forEachRemaining(Consumer<? super String> action)

Overrides default java.util.Spliterator.forEachRemaining.

Doc from java.util.Spliterator.forEachRemaining.

Performs the given action for each remaining element, sequentially in the current thread, until all elements have been processed or the action throws an exception. If this Spliterator is ORDERED, actions are performed in encounter order. Exceptions thrown by the action are relayed to the caller.

Subsequent behavior of a spliterator is unspecified if the action throws an exception.

Annotations
@Override
indexOfLineSeparatorback to summary
private int indexOfLineSeparator(int start)
nextback to summary
private String next()
skipLineSeparatorback to summary
private int skipLineSeparator(int start)
spliteratorback to summary
pack-priv static StringLatin1.LinesSpliterator spliterator(byte[] value)
tryAdvanceback to summary
public boolean tryAdvance(Consumer<? super String> action)

Implements java.util.Spliterator.tryAdvance.

Doc from java.util.Spliterator.tryAdvance.

If a remaining element exists: performs the given action on it, returning true; else returns false. If this Spliterator is ORDERED the action is performed on the next element in encounter order. Exceptions thrown by the action are relayed to the caller.

Subsequent behavior of a spliterator is unspecified if the action throws an exception.

Annotations
@Override
trySplitback to summary
public Spliterator<String> trySplit()

Implements java.util.Spliterator.trySplit.

Doc from java.util.Spliterator.trySplit.

If this spliterator can be partitioned, returns a Spliterator covering elements, that will, upon return from this method, not be covered by this Spliterator.

If this Spliterator is ORDERED, the returned Spliterator must cover a strict prefix of the elements.

Unless this Spliterator covers an infinite number of elements, repeated calls to trySplit() must eventually return null. Upon non-null return:

  • the value reported for estimateSize() before splitting, must, after splitting, be greater than or equal to estimateSize() for this and the returned Spliterator; and
  • if this Spliterator is SUBSIZED, then estimateSize() for this spliterator before splitting must be equal to the sum of estimateSize() for this and the returned Spliterator after splitting.

This method may return null for any reason, including emptiness, inability to split after traversal has commenced, data structure constraints, and efficiency considerations.

Annotations
@Override