public abstract class CodePointIterator extends Object
Modifier and Type | Field and Description |
---|---|
static CodePointIterator |
EMPTY
The empty code point iterator.
|
Constructor and Description |
---|
CodePointIterator() |
Modifier and Type | Method and Description |
---|---|
ByteIterator |
asLatin1()
Get a byte iterator over the latin-1 encoding of this code point iterator.
|
ByteIterator |
asUtf8()
Get a byte iterator over the UTF-8 encoding of this code point iterator.
|
ByteIterator |
asUtf8(boolean escapeNul)
Get a byte iterator over the UTF-8 encoding of this code point iterator.
|
ByteIterator |
base32Decode()
Base32-decode the current stream.
|
ByteIterator |
base32Decode(Alphabet.Base32Alphabet alphabet)
Base32-decode the current stream.
|
ByteIterator |
base32Decode(Alphabet.Base32Alphabet alphabet,
boolean requirePadding)
Base32-decode the current stream.
|
ByteIterator |
base64Decode()
Base64-decode the current stream.
|
ByteIterator |
base64Decode(Alphabet.Base64Alphabet alphabet)
Base64-decode the current stream.
|
ByteIterator |
base64Decode(Alphabet.Base64Alphabet alphabet,
boolean requirePadding)
Base64-decode the current stream.
|
boolean |
contentEquals(CodePointIterator other)
Determine if the remaining contents of this iterator are identical to the remaining contents of the other iterator.
|
CodePointIterator |
delimitedBy(int... delims)
Get a sub-iterator that is delimited by the given code points.
|
StringBuilder |
drainTo(StringBuilder b)
Drain all the remaining code points in this iterator to the given string builder.
|
StringBuilder |
drainTo(StringBuilder b,
int delim,
int n)
Drain all the remaining code points in this iterator to the given string builder,
inserting the given delimiter after every
n code points. |
StringBuilder |
drainTo(StringBuilder b,
String prefix,
int n)
Drain all the remaining code points in this iterator to the given string builder,
inserting the given prefix before every
n code points. |
StringBuilder |
drainTo(StringBuilder b,
String prefix,
int delim,
int n)
Drain all the remaining code points in this iterator to the given string builder,
inserting the given prefix and delimiter before and after every
n code points,
respectively. |
String |
drainToString()
Drain all the remaining code points in this iterator to a new string.
|
String |
drainToString(int delim,
int n)
Drain all the remaining code points in this iterator to a new string,
inserting the given delimiter after every
n code points. |
String |
drainToString(String prefix,
int n)
Drain all the remaining code points in this iterator to a new string,
inserting the given prefix before every
n code points. |
String |
drainToString(String prefix,
int delim,
int n)
Drain all the remaining code points in this iterator to a new string,
inserting the given prefix and delimiter before and after every
n
code points, respectively. |
abstract boolean |
hasNext()
Determine if there are more code points after the current code point.
|
abstract boolean |
hasPrev()
Determine if there are more code points before the current code point.
|
ByteIterator |
hexDecode()
Hex-decode the current stream.
|
CodePointIterator |
limitedTo(int size)
Return a copy of this iterator which is limited to the given number of code points after the current one.
|
abstract int |
next()
Get the next code point.
|
static CodePointIterator |
ofChars(char[] chars)
Get a code point iterator for a character array.
|
static CodePointIterator |
ofChars(char[] chars,
int offs)
Get a code point iterator for a character array.
|
static CodePointIterator |
ofChars(char[] chars,
int offs,
int len)
Get a code point iterator for a character array.
|
abstract int |
offset()
Get the current offset, by code point.
|
static CodePointIterator |
ofLatin1Bytes(byte[] bytes)
Get a code point iterator for a ISO-8859-1 (Latin-1) encoded array.
|
static CodePointIterator |
ofLatin1Bytes(byte[] bytes,
int offs,
int len)
Get a code point iterator for a ISO-8859-1 (Latin-1) encoded array.
|
static CodePointIterator |
ofString(String string)
Get a code point iterator for a string.
|
static CodePointIterator |
ofString(String string,
int offs,
int len)
Get a code point iterator for a string.
|
static CodePointIterator |
ofUtf8Bytes(byte[] bytes)
Get a code point iterator for a UTF-8 encoded byte array.
|
static CodePointIterator |
ofUtf8Bytes(byte[] bytes,
int offs,
int len)
Get a code point iterator for a UTF-8 encoded array.
|
abstract int |
peekNext()
Peek at the next code point without advancing.
|
abstract int |
peekPrev()
Peek at the previous code point without moving backwards.
|
abstract int |
prev()
Get the previous code point.
|
public static final CodePointIterator EMPTY
public abstract boolean hasNext()
true
if there are more code points, false
otherwisepublic abstract boolean hasPrev()
true
if there are more code points, false
otherwisepublic abstract int next() throws NoSuchElementException
NoSuchElementException
- if hasNext()
returns false
public abstract int peekNext() throws NoSuchElementException
NoSuchElementException
- if hasNext()
returns false
public abstract int prev() throws NoSuchElementException
NoSuchElementException
- if hasPrev()
returns false
public abstract int peekPrev() throws NoSuchElementException
NoSuchElementException
- if hasPrev()
returns false
public abstract int offset()
public final boolean contentEquals(CodePointIterator other)
next()
will be the differing code point. If the contents are equal, the iterators will both be
positioned at the end of their contents.other
- the other byte iteratortrue
if the contents are equal, false
otherwisepublic final CodePointIterator limitedTo(int size)
size
- the number of code pointspublic final CodePointIterator delimitedBy(int... delims)
false
for hasNext()
if the next
character in the encapsulated iterator is a delimiter or if the underlying iterator returns false
for
hasNext()
.delims
- the code point delimiterspublic StringBuilder drainTo(StringBuilder b)
b
- the string builderpublic StringBuilder drainTo(StringBuilder b, String prefix, int delim, int n)
n
code points,
respectively.b
- the string builderprefix
- the prefixdelim
- the delimitern
- the number of code points between each prefix and delimiterpublic StringBuilder drainTo(StringBuilder b, int delim, int n)
n
code points.b
- the string builderdelim
- the delimitern
- the number of code points between each delimiterpublic StringBuilder drainTo(StringBuilder b, String prefix, int n)
n
code points.b
- the string builderprefix
- the prefixn
- the number of code points between each prefixpublic String drainToString()
public String drainToString(String prefix, int delim, int n)
n
code points, respectively.prefix
- the prefixdelim
- the delimitern
- the number of code points between each prefix and delimiterpublic String drainToString(int delim, int n)
n
code points.delim
- the delimitern
- the number of code points between each delimiterpublic String drainToString(String prefix, int n)
n
code points.prefix
- the prefixn
- the number of code points between each prefixpublic ByteIterator base64Decode(Alphabet.Base64Alphabet alphabet, boolean requirePadding)
alphabet
- the alphabet to userequirePadding
- true
to require padding, false
if padding is optionalpublic ByteIterator base64Decode(Alphabet.Base64Alphabet alphabet)
alphabet
- the alphabet to usepublic ByteIterator base64Decode()
public ByteIterator base32Decode(Alphabet.Base32Alphabet alphabet, boolean requirePadding)
alphabet
- the alphabet to userequirePadding
- true
to require padding, false
if padding is optionalpublic ByteIterator base32Decode(Alphabet.Base32Alphabet alphabet)
alphabet
- the alphabet to usepublic ByteIterator base32Decode()
public ByteIterator hexDecode()
public ByteIterator asLatin1()
public ByteIterator asUtf8()
public ByteIterator asUtf8(boolean escapeNul)
escapeNul
- true
to escape NUL (0) characters as two bytes, false
to encode them as one bytepublic static CodePointIterator ofString(String string)
string
- the stringpublic static CodePointIterator ofString(String string, int offs, int len)
string
- the stringpublic static CodePointIterator ofChars(char[] chars)
chars
- the arraypublic static CodePointIterator ofChars(char[] chars, int offs)
chars
- the arrayoffs
- the array offsetpublic static CodePointIterator ofChars(char[] chars, int offs, int len)
chars
- the arrayoffs
- the array offsetlen
- the number of characters to includepublic static CodePointIterator ofUtf8Bytes(byte[] bytes)
bytes
- the arraypublic static CodePointIterator ofUtf8Bytes(byte[] bytes, int offs, int len)
bytes
- the arrayoffs
- the array offsetlen
- the number of characters to includepublic static CodePointIterator ofLatin1Bytes(byte[] bytes)
bytes
- the arraypublic static CodePointIterator ofLatin1Bytes(byte[] bytes, int offs, int len)
bytes
- the arrayoffs
- the array offsetlen
- the number of characters to includeCopyright © 2016 JBoss by Red Hat. All rights reserved.