org.jnetstream.capture.file
Interface Record

All Superinterfaces:
com.slytechs.utils.collection.Validatable
All Known Subinterfaces:
BlockRecord, DataRecord, NAPBlockRecord, NAPCaptureSystem, NAPDataRecord, NAPEvent, NAPExpert, NAPMetaRecord, NAPNoOp, NAPProperty, NAPRecord, NAPRouting, NAPVendor, PcapBlockRecord, PcapPacketRecord, PcapRecord, SnoopBlockRecord, SnoopPacketRecord, SnoopRecord

public interface Record
extends com.slytechs.utils.collection.Validatable

A record within a capture file. Capture files contain multiple records which contain data. This interface provides access to a generic Record. Each record has at minimum, a header and content area. You can use various methods in this interface to access and manipulate these standard fields within the record.

Record consists of a header and record content. Records retrieve the header and content into separate buffers. Also when you modify the record you may supply each of the two buffers separately. You may use #getHeaderBuffer and #getContentBuffer method calls to retrieve raw buffers.

The header contains information about the record. The most important of which is the type of record and record's overall length. Use the getRecordType() method to get the records type and getRecordLength() to get the entire record's length.

Author:
Mark Bednarczyk, Sly Technologies, Inc.

Nested Class Summary
static interface Record.RecordHeaderField
           
 
Method Summary
<T extends Record>
T
asType(java.lang.Class<T> c)
          Converts the current record to more specific type of 'c'.
 void edit()
           
 FileCapture getFileCapture()
          Gets the current FileCapture that this record is part of.
 long getPositionGlobal()
           
 java.nio.ByteBuffer getRecordBuffer()
           
 java.nio.ByteBuffer getRecordHeaderBuffer()
          Returns the current active buffer that stores this record header.
 int getRecordHeaderLength()
          Length of the header of this record.
 long getRecordLength()
          Returns the length of the entire record.
 RecordType getRecordType()
          Returns the type of this record.
 
Methods inherited from interface com.slytechs.utils.collection.Validatable
isValid
 

Method Detail

getFileCapture

FileCapture getFileCapture()
Gets the current FileCapture that this record is part of. If the record is not attached to a file a null will be returned.

Returns:
current FileCapture session this record is attached to or null if none

getRecordType

RecordType getRecordType()
Returns the type of this record. There are certain standard record types defined, plus each file type may define addtional record types beyond the standard ones.

Returns:
Type of this record.

getRecordHeaderBuffer

java.nio.ByteBuffer getRecordHeaderBuffer()
                                          throws java.io.IOException
Returns the current active buffer that stores this record header. The buffer's position and limit properties are set to point exactly at the header's content.

Returns:
the buffer for this record's header
Throws:
java.io.IOException

getRecordHeaderLength

int getRecordHeaderLength()
Length of the header of this record. The record length is file format specific althogh it is usually constant for each record type.

Returns:
length of this record's header

getRecordLength

long getRecordLength()
                     throws java.io.IOException
Returns the length of the entire record.

Returns:
length of the record in octets
Throws:
java.io.IOException

getRecordBuffer

java.nio.ByteBuffer getRecordBuffer()
                                    throws java.io.IOException
Throws:
java.io.IOException

getPositionGlobal

long getPositionGlobal()
                       throws java.io.IOException
Throws:
java.io.IOException

edit

void edit()
          throws java.io.IOException
Throws:
java.io.IOException

asType

<T extends Record> T asType(java.lang.Class<T> c)
Converts the current record to more specific type of 'c'. The user must ensure that the record type is record is actually the correct type.

Type Parameters:
T -
Parameters:
c -
Returns: