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.
  • Constructor Details

    • ByteIterator

      public ByteIterator()
  • Method Details

    • len

      public abstract int len()
    • head

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

      public abstract byte next()
      Specified by:
      next in interface scala.collection.Iterator<Object>
    • clear

      protected abstract void clear()
    • $plus$plus

      public ByteIterator $plus$plus(scala.collection.IterableOnce<Object> that)
    • clone

      public ByteIterator clone()
      Overrides:
      clone in class Object
    • duplicate

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

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

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

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

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

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

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

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

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

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

      public abstract ByteString toByteString()
    • toSeq

      public ByteString toSeq()
      Specified by:
      toSeq in interface scala.collection.IterableOnceOps<Object,scala.collection.Iterator,scala.collection.Iterator<Object>>
    • foreach

      public <U> void foreach(scala.Function1<Object,U> f)
      Specified by:
      foreach in interface scala.collection.IterableOnceOps<Object,scala.collection.Iterator,scala.collection.Iterator<Object>>
    • foldLeft

      public <B> B foldLeft(B z, scala.Function2<B,Object,B> op)
      Specified by:
      foldLeft in interface scala.collection.IterableOnceOps<Object,scala.collection.Iterator,scala.collection.Iterator<Object>>
    • toArray

      public <B> Object toArray(scala.reflect.ClassTag<B> arg0)
      Specified by:
      toArray in interface scala.collection.IterableOnceOps<Object,scala.collection.Iterator,scala.collection.Iterator<Object>>
    • getByte

      public byte getByte()
      Get a single Byte from this iterator. Identical to next().
    • getShort

      public short getShort(ByteOrder byteOrder)
      Get a single Short from this iterator.
    • getInt

      public int getInt(ByteOrder byteOrder)
      Get a single Int from this iterator.
    • getLong

      public long getLong(ByteOrder byteOrder)
      Get a single Long from this iterator.
    • getLongPart

      public long getLongPart(int n, ByteOrder byteOrder)
      Get a Long from this iterator where only the least significant n bytes were encoded.
    • getFloat

      public float getFloat(ByteOrder byteOrder)
    • getDouble

      public double getDouble(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, ByteOrder byteOrder)
      Get a number of Shorts from this iterator.
    • getShorts

      public abstract ByteIterator getShorts(short[] xs, int offset, int n, ByteOrder byteOrder)
      Get a number of Shorts from this iterator.
    • getInts

      public ByteIterator getInts(int[] xs, ByteOrder byteOrder)
      Get a number of Ints from this iterator.
    • getInts

      public abstract ByteIterator getInts(int[] xs, int offset, int n, ByteOrder byteOrder)
      Get a number of Ints from this iterator.
    • getLongs

      public ByteIterator getLongs(long[] xs, ByteOrder byteOrder)
      Get a number of Longs from this iterator.
    • getLongs

      public abstract ByteIterator getLongs(long[] xs, int offset, int n, ByteOrder byteOrder)
      Get a number of Longs from this iterator.
    • getFloats

      public ByteIterator getFloats(float[] xs, ByteOrder byteOrder)
      Get a number of Floats from this iterator.
    • getFloats

      public abstract ByteIterator getFloats(float[] xs, int offset, int n, ByteOrder byteOrder)
      Get a number of Floats from this iterator.
    • getDoubles

      public ByteIterator getDoubles(double[] xs, ByteOrder byteOrder)
      Get a number of Doubles from this iterator.
    • getDoubles

      public abstract ByteIterator getDoubles(double[] xs, int offset, int n, ByteOrder byteOrder)
      Get a number of Doubles from this iterator.
    • copyToBuffer

      public abstract int copyToBuffer(ByteBuffer buffer)
      For performance sensitive code, call take() directly on ByteString (it's optimised there)
    • asInputStream

      public abstract InputStream asInputStream()
      Directly wraps this ByteIterator in an InputStream without copying. Read and skip operations on the stream will advance the iterator accordingly.