Packages

abstract class BagReader[T] extends Iterator[(T, Long)]

A reader of binary SiLK Bag files. This is usable as an Iterator over a pair representing the key and counter in the Bag. Depending on the contents of the Bag file, the key is either an IPAddress or an Int. The counter is always a Long.

Since a Bag file may contain different key types, the BagReader factory methods return a BagResult wrapper over BagReader.

The keyType and counterType methods return a BagDataType that specifies the type of the key and the counter that were specified in the Bag file's header.

Example:
  1. This example uses the single argument form of the companion object's ofInputStream() method to read the Bag file "example.bag". This code may be used outside of Hadoop when it is known that the Bag's key is an IPAddress.

    val stream = new java.io.FileInputStream("example.bag")
    val bagresult = BagReader.ofInputStream(stream)
    val bag = bagresult match {
      case BagResult.IPAddressBag(iter) => iter
      case _ => null
    }
    bag.hasNext
    val (ipaddr, counter) = bag.next()
Note

While the SiLK command lines tools display an unspecified key type as an IPv4 address, the BagReader class treats an unspecified key type as an integer.

See also

the companion object for more details.

Linear Supertypes
Iterator[(T, Long)], TraversableOnce[(T, Long)], GenTraversableOnce[(T, Long)], AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. BagReader
  2. Iterator
  3. TraversableOnce
  4. GenTraversableOnce
  5. AnyRef
  6. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Instance Constructors

  1. new BagReader(reader: BufferReader, header: Header)
    Attributes
    protected

Type Members

  1. class GroupedIterator[B >: A] extends AbstractIterator[Seq[B]] with Iterator[Seq[B]]
    Definition Classes
    Iterator

Abstract Value Members

  1. abstract def next(): (T, Long)

    Produces the next (key, counter) pair of this iterator.

    Produces the next (key, counter) pair of this iterator.

    returns

    the next pair of this iterator if hasNext is true

    Definition Classes
    BagReader → Iterator
    Exceptions thrown

    java.util.NoSuchElementException when the iterator is depleted

Concrete Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int
    Definition Classes
    AnyRef → Any
  3. def ++[B >: (T, Long)](that: ⇒ GenTraversableOnce[B]): Iterator[B]
    Definition Classes
    Iterator
  4. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  5. def addString(b: StringBuilder): StringBuilder
    Definition Classes
    TraversableOnce
  6. def addString(b: StringBuilder, sep: String): StringBuilder
    Definition Classes
    TraversableOnce
  7. def addString(b: StringBuilder, start: String, sep: String, end: String): StringBuilder
    Definition Classes
    TraversableOnce
  8. def aggregate[B](z: ⇒ B)(seqop: (B, (T, Long)) ⇒ B, combop: (B, B) ⇒ B): B
    Definition Classes
    TraversableOnce → GenTraversableOnce
  9. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  10. var bufOffset: Int

    Current position (octet offset) in the current buffer.

    Current position (octet offset) in the current buffer.

    Attributes
    protected[this]
  11. var buffer: Array[Byte]

    Current buffer of bytes being processed

    Current buffer of bytes being processed

    Attributes
    protected[this]
  12. def buffered: BufferedIterator[(T, Long)]
    Definition Classes
    Iterator
  13. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... ) @native()
  14. def collect[B](pf: PartialFunction[(T, Long), B]): Iterator[B]
    Definition Classes
    Iterator
    Annotations
    @migration
    Migration

    (Changed in version 2.8.0) collect has changed. The previous behavior can be reproduced with toSeq.

  15. def collectFirst[B](pf: PartialFunction[(T, Long), B]): Option[B]
    Definition Classes
    TraversableOnce
  16. def contains(elem: Any): Boolean
    Definition Classes
    Iterator
  17. def copyToArray[B >: (T, Long)](xs: Array[B], start: Int, len: Int): Unit
    Definition Classes
    Iterator → TraversableOnce → GenTraversableOnce
  18. def copyToArray[B >: (T, Long)](xs: Array[B]): Unit
    Definition Classes
    TraversableOnce → GenTraversableOnce
  19. def copyToArray[B >: (T, Long)](xs: Array[B], start: Int): Unit
    Definition Classes
    TraversableOnce → GenTraversableOnce
  20. def copyToBuffer[B >: (T, Long)](dest: Buffer[B]): Unit
    Definition Classes
    TraversableOnce
  21. def corresponds[B](that: GenTraversableOnce[B])(p: ((T, Long), B) ⇒ Boolean): Boolean
    Definition Classes
    Iterator
  22. def count(p: ((T, Long)) ⇒ Boolean): Int
    Definition Classes
    TraversableOnce → GenTraversableOnce
  23. def counterType: Option[BagDataType]

    Provides the data type of the counter that was specified in the Bag file's header, if any.

    Provides the data type of the counter that was specified in the Bag file's header, if any.

    returns

    the type of data in the Counter field of the Bag or None if no header was present

  24. def drop(n: Int): Iterator[(T, Long)]
    Definition Classes
    Iterator
  25. def dropWhile(p: ((T, Long)) ⇒ Boolean): Iterator[(T, Long)]
    Definition Classes
    Iterator
  26. def duplicate: (Iterator[(T, Long)], Iterator[(T, Long)])
    Definition Classes
    Iterator
  27. var endOfFile: Boolean

    Whether the end of the input stream has been reached.

    Whether the end of the input stream has been reached.

    Attributes
    protected[this]
  28. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  29. def equals(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  30. def exists(p: ((T, Long)) ⇒ Boolean): Boolean
    Definition Classes
    Iterator → TraversableOnce → GenTraversableOnce
  31. def fillBuffer(): Unit

    Read a new buffer into memory if needed.

    Read a new buffer into memory if needed. Does no work if the current buffer still has unread records, or if the reader is at end of file. Sets endOfFile to true if the EOF is reached.

    Attributes
    protected[this]
  32. def filter(p: ((T, Long)) ⇒ Boolean): Iterator[(T, Long)]
    Definition Classes
    Iterator
  33. def filterNot(p: ((T, Long)) ⇒ Boolean): Iterator[(T, Long)]
    Definition Classes
    Iterator
  34. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  35. def find(p: ((T, Long)) ⇒ Boolean): Option[(T, Long)]
    Definition Classes
    Iterator → TraversableOnce → GenTraversableOnce
  36. def flatMap[B](f: ((T, Long)) ⇒ GenTraversableOnce[B]): Iterator[B]
    Definition Classes
    Iterator
  37. def fold[A1 >: (T, Long)](z: A1)(op: (A1, A1) ⇒ A1): A1
    Definition Classes
    TraversableOnce → GenTraversableOnce
  38. def foldLeft[B](z: B)(op: (B, (T, Long)) ⇒ B): B
    Definition Classes
    TraversableOnce → GenTraversableOnce
  39. def foldRight[B](z: B)(op: ((T, Long), B) ⇒ B): B
    Definition Classes
    TraversableOnce → GenTraversableOnce
  40. def forall(p: ((T, Long)) ⇒ Boolean): Boolean
    Definition Classes
    Iterator → TraversableOnce → GenTraversableOnce
  41. def foreach[U](f: ((T, Long)) ⇒ U): Unit
    Definition Classes
    Iterator → TraversableOnce → GenTraversableOnce
  42. final def getClass(): Class[_]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  43. def grouped[B >: (T, Long)](size: Int): GroupedIterator[B]
    Definition Classes
    Iterator
  44. def hasDefiniteSize: Boolean
    Definition Classes
    Iterator → TraversableOnce → GenTraversableOnce
  45. def hasNext: Boolean

    Tests whether this iterator can provide another (key, counter) pair.

    Tests whether this iterator can provide another (key, counter) pair.

    returns

    true if a subsequent call to next() will yield an element, false otherwise.

    Definition Classes
    BagReader → Iterator
  46. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  47. val header: Header
    Attributes
    protected[this]
  48. def indexOf[B >: (T, Long)](elem: B, from: Int): Int
    Definition Classes
    Iterator
  49. def indexOf[B >: (T, Long)](elem: B): Int
    Definition Classes
    Iterator
  50. def indexWhere(p: ((T, Long)) ⇒ Boolean, from: Int): Int
    Definition Classes
    Iterator
  51. def indexWhere(p: ((T, Long)) ⇒ Boolean): Int
    Definition Classes
    Iterator
  52. def isEmpty: Boolean
    Definition Classes
    Iterator → TraversableOnce → GenTraversableOnce
  53. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  54. def isTraversableAgain: Boolean
    Definition Classes
    Iterator → GenTraversableOnce
  55. def keyType: Option[BagDataType]

    Provides the data type of the key that was specified in the Bag file's header, if any.

    Provides the data type of the key that was specified in the Bag file's header, if any.

    returns

    the type of data in the Key field of the Bag or None if no header was present

  56. def length: Int
    Definition Classes
    Iterator
  57. def map[B](f: ((T, Long)) ⇒ B): Iterator[B]
    Definition Classes
    Iterator
  58. def max[B >: (T, Long)](implicit cmp: Ordering[B]): (T, Long)
    Definition Classes
    TraversableOnce → GenTraversableOnce
  59. def maxBy[B](f: ((T, Long)) ⇒ B)(implicit cmp: Ordering[B]): (T, Long)
    Definition Classes
    TraversableOnce → GenTraversableOnce
  60. def min[B >: (T, Long)](implicit cmp: Ordering[B]): (T, Long)
    Definition Classes
    TraversableOnce → GenTraversableOnce
  61. def minBy[B](f: ((T, Long)) ⇒ B)(implicit cmp: Ordering[B]): (T, Long)
    Definition Classes
    TraversableOnce → GenTraversableOnce
  62. def mkString: String
    Definition Classes
    TraversableOnce → GenTraversableOnce
  63. def mkString(sep: String): String
    Definition Classes
    TraversableOnce → GenTraversableOnce
  64. def mkString(start: String, sep: String, end: String): String
    Definition Classes
    TraversableOnce → GenTraversableOnce
  65. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  66. def nonEmpty: Boolean
    Definition Classes
    TraversableOnce → GenTraversableOnce
  67. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  68. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  69. def padTo[A1 >: (T, Long)](len: Int, elem: A1): Iterator[A1]
    Definition Classes
    Iterator
  70. def partition(p: ((T, Long)) ⇒ Boolean): (Iterator[(T, Long)], Iterator[(T, Long)])
    Definition Classes
    Iterator
  71. def patch[B >: (T, Long)](from: Int, patchElems: Iterator[B], replaced: Int): Iterator[B]
    Definition Classes
    Iterator
  72. def product[B >: (T, Long)](implicit num: Numeric[B]): B
    Definition Classes
    TraversableOnce → GenTraversableOnce
  73. val reader: BufferReader
    Attributes
    protected[this]
  74. val recordLength: Short

    Record length

    Record length

    Attributes
    protected[this]
  75. def reduce[A1 >: (T, Long)](op: (A1, A1) ⇒ A1): A1
    Definition Classes
    TraversableOnce → GenTraversableOnce
  76. def reduceLeft[B >: (T, Long)](op: (B, (T, Long)) ⇒ B): B
    Definition Classes
    TraversableOnce
  77. def reduceLeftOption[B >: (T, Long)](op: (B, (T, Long)) ⇒ B): Option[B]
    Definition Classes
    TraversableOnce → GenTraversableOnce
  78. def reduceOption[A1 >: (T, Long)](op: (A1, A1) ⇒ A1): Option[A1]
    Definition Classes
    TraversableOnce → GenTraversableOnce
  79. def reduceRight[B >: (T, Long)](op: ((T, Long), B) ⇒ B): B
    Definition Classes
    TraversableOnce → GenTraversableOnce
  80. def reduceRightOption[B >: (T, Long)](op: ((T, Long), B) ⇒ B): Option[B]
    Definition Classes
    TraversableOnce → GenTraversableOnce
  81. def reversed: List[(T, Long)]
    Attributes
    protected[this]
    Definition Classes
    TraversableOnce
  82. def sameElements(that: Iterator[_]): Boolean
    Definition Classes
    Iterator
  83. def scanLeft[B](z: B)(op: (B, (T, Long)) ⇒ B): Iterator[B]
    Definition Classes
    Iterator
  84. def scanRight[B](z: B)(op: ((T, Long), B) ⇒ B): Iterator[B]
    Definition Classes
    Iterator
  85. def seq: Iterator[(T, Long)]
    Definition Classes
    Iterator → TraversableOnce → GenTraversableOnce
  86. def size: Int
    Definition Classes
    TraversableOnce → GenTraversableOnce
  87. def sizeHintIfCheap: Int
    Attributes
    protected[collection]
    Definition Classes
    GenTraversableOnce
  88. def slice(from: Int, until: Int): Iterator[(T, Long)]
    Definition Classes
    Iterator
  89. def sliceIterator(from: Int, until: Int): Iterator[(T, Long)]
    Attributes
    protected
    Definition Classes
    Iterator
  90. def sliding[B >: (T, Long)](size: Int, step: Int): GroupedIterator[B]
    Definition Classes
    Iterator
  91. def span(p: ((T, Long)) ⇒ Boolean): (Iterator[(T, Long)], Iterator[(T, Long)])
    Definition Classes
    Iterator
  92. def sum[B >: (T, Long)](implicit num: Numeric[B]): B
    Definition Classes
    TraversableOnce → GenTraversableOnce
  93. val swap: Boolean

    Whether to byte-swap the bytes as they are read from the buffer

    Whether to byte-swap the bytes as they are read from the buffer

    Attributes
    protected[this]
  94. final def synchronized[T0](arg0: ⇒ T0): T0
    Definition Classes
    AnyRef
  95. def take(n: Int): Iterator[(T, Long)]
    Definition Classes
    Iterator
  96. def takeWhile(p: ((T, Long)) ⇒ Boolean): Iterator[(T, Long)]
    Definition Classes
    Iterator
  97. def to[Col[_]](implicit cbf: CanBuildFrom[Nothing, (T, Long), Col[(T, Long)]]): Col[(T, Long)]
    Definition Classes
    TraversableOnce → GenTraversableOnce
  98. def toArray[B >: (T, Long)](implicit arg0: ClassTag[B]): Array[B]
    Definition Classes
    TraversableOnce → GenTraversableOnce
  99. def toBuffer[B >: (T, Long)]: Buffer[B]
    Definition Classes
    TraversableOnce → GenTraversableOnce
  100. def toIndexedSeq: IndexedSeq[(T, Long)]
    Definition Classes
    TraversableOnce → GenTraversableOnce
  101. def toIterable: Iterable[(T, Long)]
    Definition Classes
    TraversableOnce → GenTraversableOnce
  102. def toIterator: Iterator[(T, Long)]
    Definition Classes
    Iterator → GenTraversableOnce
  103. def toList: List[(T, Long)]
    Definition Classes
    TraversableOnce → GenTraversableOnce
  104. def toMap[T, U](implicit ev: <:<[(T, Long), (T, U)]): Map[T, U]
    Definition Classes
    TraversableOnce → GenTraversableOnce
  105. def toSeq: Seq[(T, Long)]
    Definition Classes
    TraversableOnce → GenTraversableOnce
  106. def toSet[B >: (T, Long)]: Set[B]
    Definition Classes
    TraversableOnce → GenTraversableOnce
  107. def toStream: Stream[(T, Long)]
    Definition Classes
    Iterator → GenTraversableOnce
  108. def toString(): String
    Definition Classes
    Iterator → AnyRef → Any
  109. def toTraversable: Traversable[(T, Long)]
    Definition Classes
    Iterator → TraversableOnce → GenTraversableOnce
  110. def toVector: Vector[(T, Long)]
    Definition Classes
    TraversableOnce → GenTraversableOnce
  111. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  112. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  113. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... ) @native()
  114. def withFilter(p: ((T, Long)) ⇒ Boolean): Iterator[(T, Long)]
    Definition Classes
    Iterator
  115. def zip[B](that: Iterator[B]): Iterator[((T, Long), B)]
    Definition Classes
    Iterator
  116. def zipAll[B, A1 >: (T, Long), B1 >: B](that: Iterator[B], thisElem: A1, thatElem: B1): Iterator[(A1, B1)]
    Definition Classes
    Iterator
  117. def zipWithIndex: Iterator[((T, Long), Int)]
    Definition Classes
    Iterator

Deprecated Value Members

  1. def /:[B](z: B)(op: (B, (T, Long)) ⇒ B): B
    Definition Classes
    TraversableOnce → GenTraversableOnce
    Annotations
    @deprecated
    Deprecated

    (Since version 2.12.10) Use foldLeft instead of /:

  2. def :\[B](z: B)(op: ((T, Long), B) ⇒ B): B
    Definition Classes
    TraversableOnce → GenTraversableOnce
    Annotations
    @deprecated
    Deprecated

    (Since version 2.12.10) Use foldRight instead of :\

Inherited from Iterator[(T, Long)]

Inherited from TraversableOnce[(T, Long)]

Inherited from GenTraversableOnce[(T, Long)]

Inherited from AnyRef

Inherited from Any

Ungrouped