Package akka.util

Class 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.
    • 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.InputStream asInputStream()
      Directly wraps this ByteIterator in an InputStream without copying.
      protected abstract void clear()  
      ByteIterator clone()  
      abstract int copyToBuffer​(java.nio.ByteBuffer buffer)
      For performance sensitive code, call take() directly on ByteString (it's optimised there)
      ByteIterator drop​(int n)  
      ByteIterator dropWhile​(scala.Function1<java.lang.Object,​java.lang.Object> p)  
      scala.Tuple2<ByteIterator,​ByteIterator> duplicate()  
      <B> B foldLeft​(B z, scala.Function2<B,​java.lang.Object,​B> op)  
      <U> void foreach​(scala.Function1<java.lang.Object,​U> f)  
      byte getByte()
      Get a single Byte from this iterator.
      ByteIterator 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.
      ByteString getByteString​(int n)
      Get a ByteString with specific number of Bytes from this iterator.
      double getDouble​(java.nio.ByteOrder byteOrder)  
      abstract ByteIterator getDoubles​(double[] xs, int offset, int n, java.nio.ByteOrder byteOrder)
      Get a number of Doubles from this iterator.
      ByteIterator getDoubles​(double[] xs, java.nio.ByteOrder byteOrder)
      Get a number of Doubles from this iterator.
      float getFloat​(java.nio.ByteOrder byteOrder)  
      abstract ByteIterator getFloats​(float[] xs, int offset, int n, java.nio.ByteOrder byteOrder)
      Get a number of Floats from this iterator.
      ByteIterator getFloats​(float[] xs, java.nio.ByteOrder byteOrder)
      Get a number of Floats from this iterator.
      int getInt​(java.nio.ByteOrder byteOrder)
      Get a single Int from this iterator.
      abstract ByteIterator getInts​(int[] xs, int offset, int n, java.nio.ByteOrder byteOrder)
      Get a number of Ints from this iterator.
      ByteIterator getInts​(int[] xs, java.nio.ByteOrder byteOrder)
      Get a number of Ints from this iterator.
      long getLong​(java.nio.ByteOrder byteOrder)
      Get a single Long from this iterator.
      long getLongPart​(int n, java.nio.ByteOrder byteOrder)
      Get a Long from this iterator where only the least significant n bytes were encoded.
      abstract ByteIterator getLongs​(long[] xs, int offset, int n, java.nio.ByteOrder byteOrder)
      Get a number of Longs from this iterator.
      ByteIterator getLongs​(long[] xs, java.nio.ByteOrder byteOrder)
      Get a number of Longs from this iterator.
      short getShort​(java.nio.ByteOrder byteOrder)
      Get a single Short from this iterator.
      abstract ByteIterator getShorts​(short[] xs, int offset, int n, java.nio.ByteOrder byteOrder)
      Get a number of Shorts from this iterator.
      ByteIterator getShorts​(short[] xs, java.nio.ByteOrder byteOrder)
      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<java.lang.Object,​java.lang.Object> p, int from)  
      int indexWhere$default$2()  
      abstract int len()  
      abstract byte next()  
      ByteIterator slice​(int from, int until)  
      scala.Tuple2<ByteIterator,​ByteIterator> span​(scala.Function1<java.lang.Object,​java.lang.Object> p)  
      ByteIterator take​(int n)  
      ByteIterator takeWhile​(scala.Function1<java.lang.Object,​java.lang.Object> p)  
      <B> java.lang.Object toArray​(scala.reflect.ClassTag<B> arg0)  
      abstract ByteString toByteString()  
      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 Detail

      • ByteIterator

        public ByteIterator()
    • Method Detail

      • len

        public abstract int len()
      • head

        public abstract byte head()
        Specified by:
        head in interface scala.collection.BufferedIterator<java.lang.Object>
      • next

        public abstract byte next()
        Specified by:
        next in interface scala.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:
        clone in class java.lang.Object
      • duplicate

        public scala.Tuple2<ByteIterator,​ByteIterator> duplicate()
        Specified by:
        duplicate in interface scala.collection.Iterator<java.lang.Object>
      • take

        public ByteIterator take​(int n)
        Specified by:
        take in interface scala.collection.IterableOnceOps<java.lang.Object,​scala.collection.Iterator,​scala.collection.Iterator<java.lang.Object>>
        Specified by:
        take in interface scala.collection.Iterator<java.lang.Object>
      • drop

        public ByteIterator drop​(int n)
        Specified by:
        drop in interface scala.collection.IterableOnceOps<java.lang.Object,​scala.collection.Iterator,​scala.collection.Iterator<java.lang.Object>>
        Specified by:
        drop in interface scala.collection.Iterator<java.lang.Object>
      • slice

        public ByteIterator slice​(int from,
                                  int until)
        Specified by:
        slice in interface scala.collection.IterableOnceOps<java.lang.Object,​scala.collection.Iterator,​scala.collection.Iterator<java.lang.Object>>
        Specified by:
        slice in interface scala.collection.Iterator<java.lang.Object>
      • takeWhile

        public ByteIterator takeWhile​(scala.Function1<java.lang.Object,​java.lang.Object> p)
        Specified by:
        takeWhile in interface scala.collection.IterableOnceOps<java.lang.Object,​scala.collection.Iterator,​scala.collection.Iterator<java.lang.Object>>
        Specified by:
        takeWhile in interface scala.collection.Iterator<java.lang.Object>
      • dropWhile

        public ByteIterator dropWhile​(scala.Function1<java.lang.Object,​java.lang.Object> p)
        Specified by:
        dropWhile in interface scala.collection.IterableOnceOps<java.lang.Object,​scala.collection.Iterator,​scala.collection.Iterator<java.lang.Object>>
        Specified by:
        dropWhile in interface scala.collection.Iterator<java.lang.Object>
      • span

        public scala.Tuple2<ByteIterator,​ByteIterator> span​(scala.Function1<java.lang.Object,​java.lang.Object> p)
        Specified by:
        span in interface scala.collection.IterableOnceOps<java.lang.Object,​scala.collection.Iterator,​scala.collection.Iterator<java.lang.Object>>
        Specified by:
        span in interface scala.collection.Iterator<java.lang.Object>
      • indexWhere

        public int indexWhere​(scala.Function1<java.lang.Object,​java.lang.Object> p,
                              int from)
        Specified by:
        indexWhere in interface scala.collection.Iterator<java.lang.Object>
      • indexWhere$default$2

        public int indexWhere$default$2()
        Specified by:
        indexWhere$default$2 in interface scala.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:
        indexOf in interface scala.collection.Iterator<java.lang.Object>
      • indexOf

        public <B> int indexOf​(B elem,
                               int from)
        Specified by:
        indexOf in interface scala.collection.Iterator<java.lang.Object>
      • toByteString

        public abstract ByteString toByteString()
      • toSeq

        public ByteString toSeq()
        Specified by:
        toSeq in interface scala.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:
        foreach in interface scala.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:
        foldLeft in interface scala.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:
        toArray in interface scala.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 significant n bytes 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 &lt; 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 &lt; n or if (xs.length - offset) &lt; 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 &lt; 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 &lt; 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.