akka.util
Class ByteIterator

java.lang.Object
  extended by akka.util.ByteIterator
All Implemented Interfaces:
scala.collection.BufferedIterator<java.lang.Object>, scala.collection.GenTraversableOnce<java.lang.Object>, scala.collection.Iterator<java.lang.Object>, scala.collection.TraversableOnce<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
static class ByteIterator.ByteArrayIterator
           
static class ByteIterator.ByteArrayIterator$
           
static class ByteIterator.MultiByteArrayIterator
           
static class ByteIterator.MultiByteArrayIterator$
           
 
Nested classes/interfaces inherited from interface scala.collection.Iterator
scala.collection.Iterator.ConcatIterator<A>, scala.collection.Iterator.GroupedIterator<B>, scala.collection.Iterator.JoinIterator<A>
 
Nested classes/interfaces inherited from interface scala.collection.TraversableOnce
scala.collection.TraversableOnce.BufferedCanBuildFrom<A,CC extends scala.collection.TraversableOnce<java.lang.Object>>, scala.collection.TraversableOnce.FlattenOps<A>, scala.collection.TraversableOnce.ForceImplicitAmbiguity, scala.collection.TraversableOnce.MonadOps<A>, scala.collection.TraversableOnce.OnceCanBuildFrom<A>
 
Constructor Summary
ByteIterator()
           
 
Method Summary
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)
          Copy as many bytes as possible to a ByteBuffer, starting from it's current position.
 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.
 double getDouble(java.nio.ByteOrder byteOrder)
           
 ByteIterator getDoubles(double[] xs, java.nio.ByteOrder byteOrder)
          Get a number of Doubles from this iterator.
abstract  ByteIterator getDoubles(double[] xs, int offset, int n, java.nio.ByteOrder byteOrder)
          Get a number of Doubles from this iterator.
 float getFloat(java.nio.ByteOrder byteOrder)
           
 ByteIterator getFloats(float[] xs, java.nio.ByteOrder byteOrder)
          Get a number of Floats from this iterator.
abstract  ByteIterator getFloats(float[] xs, int offset, int n, 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.
 ByteIterator getInts(int[] xs, java.nio.ByteOrder byteOrder)
          Get a number of Ints from this iterator.
abstract  ByteIterator getInts(int[] xs, int offset, int n, 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.
 ByteIterator getLongs(long[] xs, java.nio.ByteOrder byteOrder)
          Get a number of Longs from this iterator.
abstract  ByteIterator getLongs(long[] xs, int offset, int n, 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.
 ByteIterator getShorts(short[] xs, java.nio.ByteOrder byteOrder)
          Get a number of Shorts from this iterator.
abstract  ByteIterator getShorts(short[] xs, int offset, int n, java.nio.ByteOrder byteOrder)
          Get a number of Shorts from this iterator.
abstract  byte head()
           
<B> int
indexOf(B elem)
           
 int indexOf(byte elem)
           
 int indexWhere(scala.Function1<java.lang.Object,java.lang.Object> p)
           
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
 
Methods inherited from interface scala.collection.Iterator
$plus$plus, collect, contains, copyToArray, corresponds, exists, filter, filterNot, find, flatMap, forall, grouped, hasDefiniteSize, hasNext, isEmpty, isTraversableAgain, length, map, padTo, partition, patch, sameElements, scanLeft, scanRight, seq, sliding, sliding$default$2, toIterator, toStream, toString, toTraversable, withFilter, zip, zipAll, zipWithIndex
 
Methods inherited from interface scala.collection.TraversableOnce
$colon$bslash, $div$colon, addString, addString, addString, aggregate, collectFirst, copyToArray, copyToArray, copyToBuffer, count, fold, foldRight, max, maxBy, min, minBy, mkString, mkString, mkString, nonEmpty, product, reduce, reduceLeft, reduceLeftOption, reduceOption, reduceRight, reduceRightOption, reversed, size, sum, to, toBuffer, toIndexedSeq, toIterable, toList, toMap, toSet, toVector
 

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()

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.Iterator<java.lang.Object>

drop

public ByteIterator drop(int n)
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.Iterator<java.lang.Object>

takeWhile

public ByteIterator takeWhile(scala.Function1<java.lang.Object,java.lang.Object> p)
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.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.Iterator<java.lang.Object>

indexWhere

public int indexWhere(scala.Function1<java.lang.Object,java.lang.Object> p)
Specified by:
indexWhere in interface scala.collection.Iterator<java.lang.Object>

indexOf

public int indexOf(byte elem)

indexOf

public <B> int indexOf(B elem)
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.GenTraversableOnce<java.lang.Object>
Specified by:
toSeq in interface scala.collection.TraversableOnce<java.lang.Object>

foreach

public <U> void foreach(scala.Function1<java.lang.Object,U> f)
Specified by:
foreach in interface scala.collection.GenTraversableOnce<java.lang.Object>
Specified by:
foreach in interface scala.collection.Iterator<java.lang.Object>
Specified by:
foreach in interface scala.collection.TraversableOnce<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.GenTraversableOnce<java.lang.Object>
Specified by:
foldLeft in interface scala.collection.TraversableOnce<java.lang.Object>

toArray

public <B> java.lang.Object toArray(scala.reflect.ClassTag<B> arg0)
Specified by:
toArray in interface scala.collection.GenTraversableOnce<java.lang.Object>
Specified by:
toArray in interface scala.collection.TraversableOnce<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 < 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.


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)
Copy as many bytes as possible to a ByteBuffer, starting from it's current position. This method will not overflow the buffer.

Parameters:
buffer - a ByteBuffer to copy bytes to
Returns:
the number of bytes actually copied

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.