BiDirIntIterator, IndexIterator, IntIteratorpublic abstract class ByteIterator extends java.lang.Object implements BiDirIntIterator, IndexIterator
| Modifier and Type | Field | Description |
|---|---|---|
static ByteIterator |
EMPTY |
The empty byte iterator.
|
| Modifier and Type | Method | Description |
|---|---|---|
ByteStringBuilder |
appendTo(ByteStringBuilder builder) |
|
java.io.InputStream |
asInputStream() |
Get this iterator as an input stream.
|
CodePointIterator |
asLatin1String() |
Get this byte iterator as a Latin-1 string.
|
CodePointIterator |
asUtf8String() |
Get this byte iterator as a UTF-8 string.
|
CodePointIterator |
base32Encode() |
Base32-encode the current stream.
|
CodePointIterator |
base32Encode(Base32Alphabet alphabet) |
Base32-encode the current stream.
|
CodePointIterator |
base32Encode(Base32Alphabet alphabet,
boolean addPadding) |
Base32-encode the current stream.
|
CodePointIterator |
base64Encode() |
Base64-encode the current stream.
|
CodePointIterator |
base64Encode(Base64Alphabet alphabet) |
Base64-encode the current stream.
|
CodePointIterator |
base64Encode(Base64Alphabet alphabet,
boolean addPadding) |
Base64-encode the current stream.
|
boolean |
contentEquals(ByteIterator other) |
Determine if the remaining contents of this iterator are identical to the remaining contents of the other iterator.
|
ByteIterator |
delimitedBy(int... delims) |
Get a sub-iterator that is delimited by the given bytes.
|
ByteIterator |
doFinal(java.security.MessageDigest digest) |
|
ByteIterator |
doFinal(javax.crypto.Mac mac) |
|
byte[] |
drain() |
Drain all the remaining bytes in this iterator.
|
int |
drain(byte[] dst) |
Drains up to
dst.length bytes from this iterator into the given dst array. |
int |
drain(byte[] dst,
int offs,
int len) |
Drains up to
len bytes from this iterator into the given dst array. |
byte[] |
drain(int count) |
Drain up to
count bytes from this iterator, returning the result. |
byte[] |
drainAll(int count) |
Drain exactly
count bytes from this iterator, returning the result. |
java.io.ByteArrayOutputStream |
drainTo(java.io.ByteArrayOutputStream stream) |
Drain all the remaining bytes in this iterator to the given stream.
|
java.lang.String |
drainToLatin1(int count) |
Convenience method to directly drain a certain number of bytes to a Latin-1 string.
|
java.lang.String |
drainToUtf8(int count) |
Convenience method to directly drain a certain number of bytes to a UTF-8 string.
|
int |
getBE16() |
|
int |
getBE32() |
|
long |
getBE64() |
|
abstract long |
getIndex() |
Get the current offset, in bytes.
|
int |
getLE16() |
|
int |
getLE32() |
|
long |
getLE64() |
|
int |
getPackedBE32() |
|
long |
getPackedBE64() |
|
abstract boolean |
hasNext() |
Determine if there are more bytes after the current byte.
|
abstract boolean |
hasPrevious() |
Determine if there are more bytes before the current byte.
|
CodePointIterator |
hexEncode() |
Hex-encode the current stream.
|
CodePointIterator |
hexEncode(boolean toUpperCase) |
Hex-encode the current stream.
|
ByteIterator |
interleavedWith(byte[] table) |
Get a byte iterator which translates this byte iterator through an interleaving table.
|
ByteIterator |
interleavedWith(int[] table) |
Get a byte iterator which translates this byte iterator through an interleaving table.
|
ByteIterator |
limitedTo(int size) |
Return a copy of this iterator which is limited to the given number of bytes after the current one.
|
abstract int |
next() |
Get the next byte.
|
static ByteIterator |
ofByteBuffer(java.nio.ByteBuffer buffer) |
Get a byte iterator for a byte buffer.
|
static ByteIterator |
ofBytes(byte... bytes) |
Get a byte iterator for a byte array.
|
static ByteIterator |
ofBytes(byte[] bytes,
int[] interleave) |
Get a byte iterator for a byte array with interleave.
|
static ByteIterator |
ofBytes(byte[] bytes,
int offs,
int len) |
Get a byte iterator for a byte array.
|
static ByteIterator |
ofBytes(byte[] bytes,
int offs,
int len,
int[] interleave) |
Get a byte iterator for a byte array with interleave.
|
static ByteIterator |
ofIterators(ByteIterator... iterators) |
Get a concatenated byte iterator.
|
abstract int |
peekNext() |
Peek at the next byte without advancing.
|
abstract int |
peekPrevious() |
Peek at the previous byte without moving backwards.
|
abstract int |
previous() |
Get the previous byte.
|
ByteIterator |
sign(java.security.Signature signature) |
|
void |
update(java.security.MessageDigest digest) |
|
void |
update(java.security.Signature signature) |
|
void |
update(javax.crypto.Mac mac) |
|
boolean |
verify(java.security.Signature signature) |
public static final ByteIterator EMPTY
public abstract boolean hasNext()
hasNext in interface BiDirIntIteratorhasNext in interface IntIteratortrue if there are more bytes, false otherwisepublic abstract boolean hasPrevious()
hasPrevious in interface BiDirIntIteratortrue if there are more bytes, false otherwisepublic abstract int next()
throws java.util.NoSuchElementException
next in interface BiDirIntIteratornext in interface IntIteratorjava.util.NoSuchElementException - if hasNext() returns falsepublic abstract int peekNext()
throws java.util.NoSuchElementException
peekNext in interface BiDirIntIteratorpeekNext in interface IntIteratorjava.util.NoSuchElementException - if hasNext() returns falsepublic abstract int previous()
throws java.util.NoSuchElementException
previous in interface BiDirIntIteratorjava.util.NoSuchElementException - if hasPrevious() returns falsepublic abstract int peekPrevious()
throws java.util.NoSuchElementException
peekPrevious in interface BiDirIntIteratorjava.util.NoSuchElementException - if hasPrevious() returns falsepublic abstract long getIndex()
getIndex in interface IndexIteratorpublic int getBE16()
throws java.util.NoSuchElementException
java.util.NoSuchElementExceptionpublic int getBE32()
throws java.util.NoSuchElementException
java.util.NoSuchElementExceptionpublic long getBE64()
throws java.util.NoSuchElementException
java.util.NoSuchElementExceptionpublic int getLE16()
throws java.util.NoSuchElementException
java.util.NoSuchElementExceptionpublic int getLE32()
throws java.util.NoSuchElementException
java.util.NoSuchElementExceptionpublic long getLE64()
throws java.util.NoSuchElementException
java.util.NoSuchElementExceptionpublic int getPackedBE32()
throws java.util.NoSuchElementException
java.util.NoSuchElementExceptionpublic long getPackedBE64()
throws java.util.NoSuchElementException
java.util.NoSuchElementExceptionpublic ByteStringBuilder appendTo(ByteStringBuilder builder)
public void update(java.security.MessageDigest digest)
public ByteIterator doFinal(java.security.MessageDigest digest)
public void update(javax.crypto.Mac mac)
public ByteIterator doFinal(javax.crypto.Mac mac)
public void update(java.security.Signature signature)
throws java.security.SignatureException
java.security.SignatureExceptionpublic ByteIterator sign(java.security.Signature signature) throws java.security.SignatureException
java.security.SignatureExceptionpublic boolean verify(java.security.Signature signature)
throws java.security.SignatureException
java.security.SignatureExceptionpublic CodePointIterator base64Encode(Base64Alphabet alphabet, boolean addPadding)
alphabet - the alphabet to useaddPadding - true to add trailing padding, false to leave it offpublic CodePointIterator base64Encode(Base64Alphabet alphabet)
alphabet - the alphabet to usepublic CodePointIterator base64Encode()
public CodePointIterator base32Encode(Base32Alphabet alphabet, boolean addPadding)
alphabet - the alphabet to useaddPadding - true to add trailing padding, false to leave it offpublic CodePointIterator base32Encode(Base32Alphabet alphabet)
alphabet - the alphabet to usepublic CodePointIterator base32Encode()
public CodePointIterator hexEncode(boolean toUpperCase)
toUpperCase - true to use upper case characters when encoding,
false to use lower case characterspublic CodePointIterator hexEncode()
public CodePointIterator asUtf8String()
public CodePointIterator asLatin1String()
public final boolean contentEquals(ByteIterator other)
other - the other byte iteratortrue if the contents are equal, false otherwisepublic final ByteIterator limitedTo(int size)
size - the number of bytespublic final ByteIterator 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 byte delimiterspublic ByteIterator interleavedWith(byte[] table)
table - the interleaving tablepublic ByteIterator interleavedWith(int[] table)
table - the interleaving tablepublic java.io.ByteArrayOutputStream drainTo(java.io.ByteArrayOutputStream stream)
stream - the streampublic byte[] drain()
public byte[] drain(int count)
count bytes from this iterator, returning the result.count - the number of bytes to readcount)public byte[] drainAll(int count)
throws java.util.NoSuchElementException
count bytes from this iterator, returning the result.count - the number of bytes to readjava.util.NoSuchElementException - if there are not enough bytes to fill the arraypublic int drain(byte[] dst)
dst.length bytes from this iterator into the given dst array.
An attempt is made to drain as many as dst.length bytes, but a smaller number may
be drained.
The number of bytes actually drained is returned as an integer. Unlike
InputStream.read(byte[], int, int), this method never returns a negative result.
dst - the buffer into which the data is draineddst, always greater or equal to 0public int drain(byte[] dst,
int offs,
int len)
len bytes from this iterator into the given dst array.
An attempt is made to drain as many as len bytes, but a smaller number may
be drained.
The number of bytes actually drained is returned as an integer. Unlike
InputStream.read(byte[], int, int), this method never returns a negative result.
dst - the buffer into which the data is drainedoffs - the start offset in array dst at which the data is written.len - the maximum number of bytes to draindst, always greater or equal to 0public java.lang.String drainToUtf8(int count)
count
bytes are available, only the available bytes will be used to construct the string.count - the maximum number of bytes to consumepublic java.lang.String drainToLatin1(int count)
count
bytes are available, only the available bytes will be used to construct the string.count - the maximum number of bytes to consumepublic static ByteIterator ofBytes(byte... bytes)
bytes - the arraypublic static ByteIterator ofBytes(byte[] bytes, int offs, int len)
bytes - the arrayoffs - the array offsetlen - the number of bytes to includepublic static ByteIterator ofBytes(byte[] bytes, int offs, int len, int[] interleave)
bytes - the arrayoffs - the array offsetlen - the number of bytes to includeinterleave - the interleave table to usepublic static ByteIterator ofBytes(byte[] bytes, int[] interleave)
bytes - the arrayinterleave - the interleave table to usepublic static ByteIterator ofByteBuffer(java.nio.ByteBuffer buffer)
buffer - the byte buffer (must not be null)null)public static ByteIterator ofIterators(ByteIterator... iterators)
iterators - the iterators array (must not be null or contain null elements)public final java.io.InputStream asInputStream()
null)Copyright © 2017 JBoss, a division of Red Hat, Inc.