jnetpcap.capture
Interface FileIterator

All Known Subinterfaces:
FileCapture, MutableFileCapture, MutableFileIterator, NapFile, PcapFile, SnoopFile

public interface FileIterator

A bi-directional, random-access iterator. Allows traversal of capture file elements or packets that physically reside inside a physical capture file (trace file.) The interface does not extend the java.util.Iterator interace because this is not a simple iterator as physical disk IO operations are usually as a result of any method invocations and appropriate IOExceptions are throws in case of errors.

The iterator allow bi-directional access to data in the file. Anotherwords you can retrieve T forwards and backwards from the current location in the file that this iterator maintains. You can also seek or skip ahead. Seeking is a search operation that searches for specified criterial using possibly heuristic algorothms or direct lookups. The actual algorithm implementation is capture file format specific. You can also skip ahead a certain number of packets backwards or forwards. For example you can skip(-1) to go back one element or simply skip() to go forward one element, but no return any T objects. Skip and seeks are done using the least possible IO operations required including cached information, but there is no guarrantee that a seek or skip will not result in any IO ops.

Author:
Mark Bednarczyk, Sly Technologies, Inc.

Method Summary
 long getPosition()
          Returns the absolute position or byte offset from the beginning of the file of the current position.
 

Method Detail

getPosition

long getPosition()
                 throws java.io.IOException
Returns the absolute position or byte offset from the beginning of the file of the current position.

Returns:
0-based byte offset of the current position
Throws:
java.io.IOException - any IO errors