org.jnetstream.capture.file.snoop
Interface SnoopFile

All Superinterfaces:
Capture<SnoopPacket>, java.io.Closeable, FileCapture<SnoopPacket>, java.io.Flushable, java.lang.Iterable<SnoopPacket>

public interface SnoopFile
extends FileCapture<SnoopPacket>

SNOOP capture file format from SUN Microsystem's folks.

Author:
Mark Bednarczyk, Sly Technologies, Inc.

Field Summary
static int HEADER_LENGTH
           
static HeaderReader headerReader
           
static org.apache.commons.logging.Log logger
           
static byte[] MAGIC_PATTERN
          Magic pattern made up of octets that uniquely identifies the "snoop" block record and the entire file as snoop file.
 
Method Summary
 com.slytechs.utils.collection.IOSkippableIterator<SnoopBlockRecord> getBlockIterator()
          Each capture file is organized so that there exists atleast 1 block record, usually at the beginning of the capture file.
 SnoopBlockRecord getBlockRecord()
           
 PacketIndexer<SnoopPacket> getPacketIndexer()
          Indexer which accesses packets by index.
 PacketIterator<SnoopPacket> getPacketIterator()
          Retrieves an iterator Iterator which can iterate over all the packets of this capture session.
 RawIndexer getRawIndexer()
          Raw ByteBuffer based record indexer.
 RawIterator getRawIterator()
          Gets an iterator that will return raw contents of the records contained in the underlying capture file.
 RecordIndexer<SnoopRecord> getRecordIndexer()
          Indexer which accesses records by index.
 RecordIterator<SnoopRecord> getRecordIterator()
          Iterator which iterates over every record within the file capture.
 
Methods inherited from interface org.jnetstream.capture.FileCapture
abortChanges, flush, getFastIterator, getFile, getFormatType, getLength, getPacketCount, getPacketCount, getRawIterator, getRecordIterator, getVersion, isEmpty, isOpen, order
 
Methods inherited from interface org.jnetstream.capture.Capture
getFilter, getType, isMutable, iterator
 

Field Detail

HEADER_LENGTH

static final int HEADER_LENGTH
See Also:
Constant Field Values

MAGIC_PATTERN

static final byte[] MAGIC_PATTERN
Magic pattern made up of octets that uniquely identifies the "snoop" block record and the entire file as snoop file.
 73 6e 6f 6f 70 00 00 00 
  S  N  O  O  P '' '' ''
 


headerReader

static final HeaderReader headerReader

logger

static final org.apache.commons.logging.Log logger
Method Detail

getBlockIterator

com.slytechs.utils.collection.IOSkippableIterator<SnoopBlockRecord> getBlockIterator()
                                                                                     throws java.io.IOException
Description copied from interface: FileCapture
Each capture file is organized so that there exists atleast 1 block record, usually at the beginning of the capture file. Block record, also sometimes called file header, contains 0 or more data records which hold some kind of information. The most common record type is packet record which has a record header and record data content which is the raw packet data.

Specified by:
getBlockIterator in interface FileCapture<SnoopPacket>
Returns:
record iterator that will iterate over all block records within the capture file
Throws:
java.io.IOException

getBlockRecord

SnoopBlockRecord getBlockRecord()

getPacketIndexer

PacketIndexer<SnoopPacket> getPacketIndexer()
                                            throws java.io.IOException
Description copied from interface: FileCapture
Indexer which accesses packets by index. The elements returned by this indexer are FilePacket based objects.

Specified by:
getPacketIndexer in interface FileCapture<SnoopPacket>
Returns:
packet indexer
Throws:
java.io.IOException - any IO errors

getPacketIterator

PacketIterator<SnoopPacket> getPacketIterator()
                                              throws java.io.IOException
Description copied from interface: Capture
Retrieves an iterator Iterator which can iterate over all the packets of this capture session. The IO based iterator mimics the methods and behaviour of its counter part Iterator that it can throw IO exceptions in any of the methods.

Specified by:
getPacketIterator in interface Capture<SnoopPacket>
Specified by:
getPacketIterator in interface FileCapture<SnoopPacket>
Returns:
Iterator capable of throwing IO exceptions
Throws:
java.io.IOException - Any IO errors while retrieving a packet

getRawIndexer

RawIndexer getRawIndexer()
                         throws java.io.IOException
Description copied from interface: FileCapture
Raw ByteBuffer based record indexer. The elements returned by this indexer are ByteBuffers which have the limit and position properties aligned to the beginning and end of recods. You access these records using list-like indexes. Raw indexer also allows some low level mutable methods.

Specified by:
getRawIndexer in interface FileCapture<SnoopPacket>
Returns:
indexer which accesses raw records
Throws:
java.io.IOException - any IO errors

getRawIterator

RawIterator getRawIterator()
                           throws java.io.IOException
Description copied from interface: FileCapture
Gets an iterator that will return raw contents of the records contained in the underlying capture file.

Specified by:
getRawIterator in interface FileCapture<SnoopPacket>
Returns:
raw record iterator
Throws:
java.io.IOException - any IO errors

getRecordIndexer

RecordIndexer<SnoopRecord> getRecordIndexer()
                                            throws java.io.IOException
Description copied from interface: FileCapture
Indexer which accesses records by index. The elements returned by this indexer are Record based objects.

Specified by:
getRecordIndexer in interface FileCapture<SnoopPacket>
Returns:
record indexer
Throws:
java.io.IOException - any IO errors

getRecordIterator

RecordIterator<SnoopRecord> getRecordIterator()
                                              throws java.io.IOException
Description copied from interface: FileCapture
Iterator which iterates over every record within the file capture. The iterator will iterate has range over every single record including the block record (i.e. file header) at the beginning of the file.

Specified by:
getRecordIterator in interface FileCapture<SnoopPacket>
Returns:
Throws:
java.io.IOException