Produces the next (key, counter) pair of this iterator.
Produces the next (key, counter) pair of this iterator.
the next pair of this iterator if hasNext is true
[[java.util.NoSuchElementException]] when the iterator
is depleted
Current position (octet offset) in the current buffer.
Current position (octet offset) in the current buffer.
Current buffer of bytes being processed
Current buffer of bytes being processed
(Changed in version 2.8.0) collect has changed. The previous behavior can be reproduced with toSeq.
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.
the type of data in the Counter field of the Bag or None
if no header was present
Whether the end of the input stream has been reached.
Whether the end of the input stream has been reached.
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.
Tests whether this iterator can provide another (key, counter) pair.
Tests whether this iterator can provide another (key, counter) pair.
true if a subsequent call to next() will yield an
element, false otherwise.
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.
the type of data in the Key field of the Bag or None
if no header was present
Record length
Record length
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
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
keyTypeandcounterTypemethods return a BagDataType that specifies the type of the key and the counter that were specified in the Bag file's header.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.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.
the companion object for more details.