Package akka.util
Class ByteIterator
- java.lang.Object
-
- akka.util.ByteIterator
-
- All Implemented Interfaces:
scala.collection.BufferedIterator<java.lang.Object>,scala.collection.IterableOnce<java.lang.Object>,scala.collection.IterableOnceOps<java.lang.Object,scala.collection.Iterator,scala.collection.Iterator<java.lang.Object>>,scala.collection.Iterator<java.lang.Object>
- Direct Known Subclasses:
ByteIterator.ByteArrayIterator,ByteIterator.MultiByteArrayIterator
public abstract class ByteIterator extends java.lang.Object implements scala.collection.BufferedIterator<java.lang.Object>An iterator over a ByteString.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classByteIterator.ByteArrayIteratorstatic classByteIterator.ByteArrayIterator$static classByteIterator.MultiByteArrayIteratorstatic classByteIterator.MultiByteArrayIterator$
-
Constructor Summary
Constructors Constructor Description ByteIterator()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description ByteIterator$plus$plus(scala.collection.IterableOnce<java.lang.Object> that)abstract java.io.InputStreamasInputStream()Directly wraps this ByteIterator in an InputStream without copying.protected abstract voidclear()ByteIteratorclone()abstract intcopyToBuffer(java.nio.ByteBuffer buffer)For performance sensitive code, call take() directly on ByteString (it's optimised there)ByteIteratordrop(int n)ByteIteratordropWhile(scala.Function1<java.lang.Object,java.lang.Object> p)scala.Tuple2<ByteIterator,ByteIterator>duplicate()<B> BfoldLeft(B z, scala.Function2<B,java.lang.Object,B> op)<U> voidforeach(scala.Function1<java.lang.Object,U> f)bytegetByte()Get a single Byte from this iterator.ByteIteratorgetBytes(byte[] xs)Get a specific number of Bytes from this iterator.abstract ByteIteratorgetBytes(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.ByteStringgetByteString(int n)Get a ByteString with specific number of Bytes from this iterator.doublegetDouble(java.nio.ByteOrder byteOrder)abstract ByteIteratorgetDoubles(double[] xs, int offset, int n, java.nio.ByteOrder byteOrder)Get a number of Doubles from this iterator.ByteIteratorgetDoubles(double[] xs, java.nio.ByteOrder byteOrder)Get a number of Doubles from this iterator.floatgetFloat(java.nio.ByteOrder byteOrder)abstract ByteIteratorgetFloats(float[] xs, int offset, int n, java.nio.ByteOrder byteOrder)Get a number of Floats from this iterator.ByteIteratorgetFloats(float[] xs, java.nio.ByteOrder byteOrder)Get a number of Floats from this iterator.intgetInt(java.nio.ByteOrder byteOrder)Get a single Int from this iterator.abstract ByteIteratorgetInts(int[] xs, int offset, int n, java.nio.ByteOrder byteOrder)Get a number of Ints from this iterator.ByteIteratorgetInts(int[] xs, java.nio.ByteOrder byteOrder)Get a number of Ints from this iterator.longgetLong(java.nio.ByteOrder byteOrder)Get a single Long from this iterator.longgetLongPart(int n, java.nio.ByteOrder byteOrder)Get a Long from this iterator where only the least significantnbytes were encoded.abstract ByteIteratorgetLongs(long[] xs, int offset, int n, java.nio.ByteOrder byteOrder)Get a number of Longs from this iterator.ByteIteratorgetLongs(long[] xs, java.nio.ByteOrder byteOrder)Get a number of Longs from this iterator.shortgetShort(java.nio.ByteOrder byteOrder)Get a single Short from this iterator.abstract ByteIteratorgetShorts(short[] xs, int offset, int n, java.nio.ByteOrder byteOrder)Get a number of Shorts from this iterator.ByteIteratorgetShorts(short[] xs, java.nio.ByteOrder byteOrder)Get a number of Shorts from this iterator.abstract bytehead()intindexOf(byte elem)intindexOf(byte elem, int from)<B> intindexOf(B elem)<B> intindexOf(B elem, int from)intindexWhere(scala.Function1<java.lang.Object,java.lang.Object> p, int from)intindexWhere$default$2()abstract intlen()abstract bytenext()ByteIteratorslice(int from, int until)scala.Tuple2<ByteIterator,ByteIterator>span(scala.Function1<java.lang.Object,java.lang.Object> p)ByteIteratortake(int n)ByteIteratortakeWhile(scala.Function1<java.lang.Object,java.lang.Object> p)<B> java.lang.ObjecttoArray(scala.reflect.ClassTag<B> arg0)abstract ByteStringtoByteString()ByteStringtoSeq()-
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
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
-
-
-
-
Method Detail
-
len
public abstract int len()
-
head
public abstract byte head()
- Specified by:
headin interfacescala.collection.BufferedIterator<java.lang.Object>
-
next
public abstract byte next()
- Specified by:
nextin interfacescala.collection.Iterator<java.lang.Object>
-
clear
protected abstract void clear()
-
$plus$plus
public ByteIterator $plus$plus(scala.collection.IterableOnce<java.lang.Object> that)
-
clone
public ByteIterator clone()
- Overrides:
clonein classjava.lang.Object
-
duplicate
public scala.Tuple2<ByteIterator,ByteIterator> duplicate()
- Specified by:
duplicatein interfacescala.collection.Iterator<java.lang.Object>
-
take
public ByteIterator take(int n)
- Specified by:
takein interfacescala.collection.IterableOnceOps<java.lang.Object,scala.collection.Iterator,scala.collection.Iterator<java.lang.Object>>- Specified by:
takein interfacescala.collection.Iterator<java.lang.Object>
-
drop
public ByteIterator drop(int n)
- Specified by:
dropin interfacescala.collection.IterableOnceOps<java.lang.Object,scala.collection.Iterator,scala.collection.Iterator<java.lang.Object>>- Specified by:
dropin interfacescala.collection.Iterator<java.lang.Object>
-
slice
public ByteIterator slice(int from, int until)
- Specified by:
slicein interfacescala.collection.IterableOnceOps<java.lang.Object,scala.collection.Iterator,scala.collection.Iterator<java.lang.Object>>- Specified by:
slicein interfacescala.collection.Iterator<java.lang.Object>
-
takeWhile
public ByteIterator takeWhile(scala.Function1<java.lang.Object,java.lang.Object> p)
- Specified by:
takeWhilein interfacescala.collection.IterableOnceOps<java.lang.Object,scala.collection.Iterator,scala.collection.Iterator<java.lang.Object>>- Specified by:
takeWhilein interfacescala.collection.Iterator<java.lang.Object>
-
dropWhile
public ByteIterator dropWhile(scala.Function1<java.lang.Object,java.lang.Object> p)
- Specified by:
dropWhilein interfacescala.collection.IterableOnceOps<java.lang.Object,scala.collection.Iterator,scala.collection.Iterator<java.lang.Object>>- Specified by:
dropWhilein interfacescala.collection.Iterator<java.lang.Object>
-
span
public scala.Tuple2<ByteIterator,ByteIterator> span(scala.Function1<java.lang.Object,java.lang.Object> p)
- Specified by:
spanin interfacescala.collection.IterableOnceOps<java.lang.Object,scala.collection.Iterator,scala.collection.Iterator<java.lang.Object>>- Specified by:
spanin interfacescala.collection.Iterator<java.lang.Object>
-
indexWhere
public int indexWhere(scala.Function1<java.lang.Object,java.lang.Object> p, int from)- Specified by:
indexWherein interfacescala.collection.Iterator<java.lang.Object>
-
indexWhere$default$2
public int indexWhere$default$2()
- Specified by:
indexWhere$default$2in interfacescala.collection.Iterator<java.lang.Object>
-
indexOf
public int indexOf(byte elem)
-
indexOf
public int indexOf(byte elem, int from)
-
indexOf
public <B> int indexOf(B elem)
- Specified by:
indexOfin interfacescala.collection.Iterator<java.lang.Object>
-
indexOf
public <B> int indexOf(B elem, int from)- Specified by:
indexOfin interfacescala.collection.Iterator<java.lang.Object>
-
toByteString
public abstract ByteString toByteString()
-
toSeq
public ByteString toSeq()
- Specified by:
toSeqin interfacescala.collection.IterableOnceOps<java.lang.Object,scala.collection.Iterator,scala.collection.Iterator<java.lang.Object>>
-
foreach
public <U> void foreach(scala.Function1<java.lang.Object,U> f)
- Specified by:
foreachin interfacescala.collection.IterableOnceOps<java.lang.Object,scala.collection.Iterator,scala.collection.Iterator<java.lang.Object>>
-
foldLeft
public <B> B foldLeft(B z, scala.Function2<B,java.lang.Object,B> op)- Specified by:
foldLeftin interfacescala.collection.IterableOnceOps<java.lang.Object,scala.collection.Iterator,scala.collection.Iterator<java.lang.Object>>
-
toArray
public <B> java.lang.Object toArray(scala.reflect.ClassTag<B> arg0)
- Specified by:
toArrayin interfacescala.collection.IterableOnceOps<java.lang.Object,scala.collection.Iterator,scala.collection.Iterator<java.lang.Object>>
-
getByte
public byte getByte()
Get a single Byte from this iterator. Identical to next().
-
getShort
public short getShort(java.nio.ByteOrder byteOrder)
Get a single Short from this iterator.
-
getInt
public int getInt(java.nio.ByteOrder byteOrder)
Get a single Int from this iterator.
-
getLong
public long getLong(java.nio.ByteOrder byteOrder)
Get a single Long from this iterator.
-
getLongPart
public long getLongPart(int n, java.nio.ByteOrder byteOrder)Get a Long from this iterator where only the least significantnbytes were encoded.
-
getFloat
public float getFloat(java.nio.ByteOrder byteOrder)
-
getDouble
public double getDouble(java.nio.ByteOrder byteOrder)
-
getBytes
public ByteIterator getBytes(byte[] xs)
Get a specific number of Bytes from this iterator. In contrast to copyToArray, this method will fail if this.len < xs.length.
-
getBytes
public abstract ByteIterator getBytes(byte[] xs, int offset, int n)
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
public ByteString getByteString(int n)
Get a ByteString with specific number of Bytes from this iterator. In contrast to copyToArray, this method will fail if this.len < n.
-
getShorts
public ByteIterator getShorts(short[] xs, java.nio.ByteOrder byteOrder)
Get a number of Shorts from this iterator.
-
getShorts
public abstract ByteIterator getShorts(short[] xs, int offset, int n, java.nio.ByteOrder byteOrder)
Get a number of Shorts from this iterator.
-
getInts
public ByteIterator getInts(int[] xs, java.nio.ByteOrder byteOrder)
Get a number of Ints from this iterator.
-
getInts
public abstract ByteIterator getInts(int[] xs, int offset, int n, java.nio.ByteOrder byteOrder)
Get a number of Ints from this iterator.
-
getLongs
public ByteIterator getLongs(long[] xs, java.nio.ByteOrder byteOrder)
Get a number of Longs from this iterator.
-
getLongs
public abstract ByteIterator getLongs(long[] xs, int offset, int n, java.nio.ByteOrder byteOrder)
Get a number of Longs from this iterator.
-
getFloats
public ByteIterator getFloats(float[] xs, java.nio.ByteOrder byteOrder)
Get a number of Floats from this iterator.
-
getFloats
public abstract ByteIterator getFloats(float[] xs, int offset, int n, java.nio.ByteOrder byteOrder)
Get a number of Floats from this iterator.
-
getDoubles
public ByteIterator getDoubles(double[] xs, java.nio.ByteOrder byteOrder)
Get a number of Doubles from this iterator.
-
getDoubles
public abstract ByteIterator getDoubles(double[] xs, int offset, int n, java.nio.ByteOrder byteOrder)
Get a number of Doubles from this iterator.
-
copyToBuffer
public abstract int copyToBuffer(java.nio.ByteBuffer buffer)
For performance sensitive code, call take() directly on ByteString (it's optimised there)
-
asInputStream
public abstract java.io.InputStream asInputStream()
Directly wraps this ByteIterator in an InputStream without copying. Read and skip operations on the stream will advance the iterator accordingly.
-
-