Package org.apache.pekko.util
Class ByteIterator
java.lang.Object
org.apache.pekko.util.ByteIterator
- All Implemented Interfaces:
scala.collection.BufferedIterator<Object>
,scala.collection.IterableOnce<Object>
,scala.collection.IterableOnceOps<Object,
,scala.collection.Iterator, scala.collection.Iterator<Object>> scala.collection.Iterator<Object>
- Direct Known Subclasses:
ByteIterator.ByteArrayIterator
,ByteIterator.MultiByteArrayIterator
public abstract class ByteIterator
extends Object
implements scala.collection.BufferedIterator<Object>
An iterator over a ByteString.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
static class
static class
static class
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription$plus$plus
(scala.collection.IterableOnce<Object> that) abstract InputStream
Directly wraps this ByteIterator in an InputStream without copying.protected abstract void
clear()
clone()
abstract int
copyToBuffer
(ByteBuffer buffer) For performance sensitive code, call take() directly on ByteString (it's optimised there)drop
(int n) scala.Tuple2<ByteIterator,
ByteIterator> <B> B
<U> void
byte
getByte()
Get a single Byte from this iterator.getBytes
(byte[] xs) Get a specific number of Bytes from this iterator.abstract ByteIterator
getBytes
(byte[] xs, int offset, int n) Get a specific number of Bytes from this iterator.byte[]
getBytes
(int n) Get a specific number of Bytes from this iterator.getByteString
(int n) Get a ByteString with specific number of Bytes from this iterator.double
abstract ByteIterator
getDoubles
(double[] xs, int offset, int n, ByteOrder byteOrder) Get a number of Doubles from this iterator.getDoubles
(double[] xs, ByteOrder byteOrder) Get a number of Doubles from this iterator.float
abstract ByteIterator
Get a number of Floats from this iterator.Get a number of Floats from this iterator.int
Get a single Int from this iterator.abstract ByteIterator
Get a number of Ints from this iterator.Get a number of Ints from this iterator.long
Get a single Long from this iterator.long
getLongPart
(int n, ByteOrder byteOrder) Get a Long from this iterator where only the least significantn
bytes were encoded.abstract ByteIterator
Get a number of Longs from this iterator.Get a number of Longs from this iterator.short
Get a single Short from this iterator.abstract ByteIterator
Get a number of Shorts from this iterator.Get a number of Shorts from this iterator.abstract byte
head()
int
indexOf
(byte elem) int
indexOf
(byte elem, int from) <B> int
indexOf
(B elem) <B> int
indexOf
(B elem, int from) int
indexWhere
(scala.Function1<Object, Object> p, int from) int
abstract int
len()
abstract byte
next()
slice
(int from, int until) scala.Tuple2<ByteIterator,
ByteIterator> take
(int n) <B> Object
toArray
(scala.reflect.ClassTag<B> arg0) abstract ByteString
toSeq()
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface scala.collection.BufferedIterator
buffered, headOption
Methods inherited from interface scala.collection.IterableOnce
knownSize, stepper
Methods inherited from interface scala.collection.IterableOnceOps
$colon$bslash, $div$colon, addString, addString, addString, aggregate, collectFirst, copyToArray, copyToArray, copyToArray, copyToBuffer, corresponds, count, exists, find, fold, foldRight, forall, isTraversableAgain, max, maxBy, maxByOption, maxOption, min, minBy, minByOption, minOption, mkString, mkString, mkString, nonEmpty, product, reduce, reduceLeft, reduceLeftOption, reduceOption, reduceRight, reduceRightOption, reversed, size, splitAt, sum, to, toBuffer, toIndexedSeq, toIterator, toList, toMap, toSet, toStream, toVector
Methods inherited from interface scala.collection.Iterator
$plus$plus, collect, concat, contains, distinct, distinctBy, filter, filterImpl, filterNot, flatMap, flatten, grouped, hasDefiniteSize, hasNext, isEmpty, iterator, length, map, nextOption, padTo, partition, patch, sameElements, scanLeft, scanRight, seq, sliceIterator, sliding, sliding$default$2, tapEach, toString, withFilter, zip, zipAll, zipWithIndex
-
Constructor Details
-
ByteIterator
public ByteIterator()
-
-
Method Details
-
len
public abstract int len() -
head
public abstract byte head()- Specified by:
head
in interfacescala.collection.BufferedIterator<Object>
-
next
public abstract byte next()- Specified by:
next
in interfacescala.collection.Iterator<Object>
-
clear
protected abstract void clear() -
$plus$plus
-
clone
-
duplicate
- Specified by:
duplicate
in interfacescala.collection.Iterator<Object>
-
take
-
drop
-
slice
-
takeWhile
-
dropWhile
-
span
-
indexWhere
- Specified by:
indexWhere
in interfacescala.collection.Iterator<Object>
-
indexWhere$default$2
public int indexWhere$default$2()- Specified by:
indexWhere$default$2
in interfacescala.collection.Iterator<Object>
-
indexOf
public int indexOf(byte elem) -
indexOf
public int indexOf(byte elem, int from) -
indexOf
public <B> int indexOf(B elem) - Specified by:
indexOf
in interfacescala.collection.Iterator<Object>
-
indexOf
public <B> int indexOf(B elem, int from) - Specified by:
indexOf
in interfacescala.collection.Iterator<Object>
-
toByteString
-
toSeq
-
foreach
-
foldLeft
-
toArray
-
getByte
public byte getByte()Get a single Byte from this iterator. Identical to next(). -
getShort
Get a single Short from this iterator. -
getInt
Get a single Int from this iterator. -
getLong
Get a single Long from this iterator. -
getLongPart
Get a Long from this iterator where only the least significantn
bytes were encoded. -
getFloat
-
getDouble
-
getBytes
Get a specific number of Bytes from this iterator. In contrast to copyToArray, this method will fail if this.len < xs.length. -
getBytes
Get a specific number of Bytes from this iterator. In contrast to copyToArray, this method will fail if length < n or if (xs.length - offset) < n. -
getBytes
public byte[] getBytes(int n) Get a specific number of Bytes from this iterator. In contrast to copyToArray, this method will fail if this.len < n. -
getByteString
Get a ByteString with specific number of Bytes from this iterator. In contrast to copyToArray, this method will fail if this.len < n. -
getShorts
Get a number of Shorts from this iterator. -
getShorts
Get a number of Shorts from this iterator. -
getInts
Get a number of Ints from this iterator. -
getInts
Get a number of Ints from this iterator. -
getLongs
Get a number of Longs from this iterator. -
getLongs
Get a number of Longs from this iterator. -
getFloats
Get a number of Floats from this iterator. -
getFloats
Get a number of Floats from this iterator. -
getDoubles
Get a number of Doubles from this iterator. -
getDoubles
Get a number of Doubles from this iterator. -
copyToBuffer
For performance sensitive code, call take() directly on ByteString (it's optimised there) -
asInputStream
Directly wraps this ByteIterator in an InputStream without copying. Read and skip operations on the stream will advance the iterator accordingly.
-