jnetpcap.capture.file
Interface DataRecord

All Superinterfaces:
Record
All Known Subinterfaces:
NAPExpert, NAPMetaRecord, NAPPacket, PcapPacketRecord, SnoopPacketRecord

public interface DataRecord
extends Record

Data record is a record in a capture file that belongs to one block record, a parent/child relationship, and contains some kind of data. Data records usually contain packet data but other types of data records also exist in certain file formats.

Author:
Mark Bednarczyk, Sly Technologies, Inc.

Nested Class Summary
 
Nested classes/interfaces inherited from interface jnetpcap.capture.file.Record
Record.Capability, Record.RecordType
 
Method Summary
<C extends DataRecord>
C
asType(java.lang.Class<C> c)
          Converts java class type of a generic record into more specific record.
 java.nio.ByteBuffer getDataBuffer()
           
 int getDataLength()
           
 BlockRecord getParent()
           
 void readData()
           
 void setDataBuffer(java.nio.ByteBuffer buffer)
           
 void writeData()
           
 
Methods inherited from interface jnetpcap.capture.file.Record
getCaptureFile, getFilePosition, getHeaderBuffer, getHeaderLength, getRecordLength, getRecordType, isModified, isWritten, read, readHeader, setFilePosition, setModified, setWritten, validateRecord, write, writeHeader
 

Method Detail

readData

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

writeData

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

getParent

BlockRecord getParent()

getDataBuffer

java.nio.ByteBuffer getDataBuffer()

setDataBuffer

void setDataBuffer(java.nio.ByteBuffer buffer)

getDataLength

int getDataLength()

asType

<C extends DataRecord> C asType(java.lang.Class<C> c)
                            throws CaptureFormatException
Converts java class type of a generic record into more specific record. This method does not do conversion between different types of records simply allows easy way of casting a record from more generic to more specific type. Note that a normal java typecast to more specific record type may fail as this is very implementation dependent behaviour and should not be relied upon. The proper way to change a Record object into a more specific object that is matched by the Record type is to use the asType(java.lang.Class) method. Note that the actual record object may be a stub in a remote session and the actual more specific type may have to be fetched accross a network conneciton.

Type Parameters:
C - class type to convert this record to. The record type must be of the correct type inorder for the cast conversion to succeed.
Parameters:
c - class instance of specific class type of a record to be converted to
Returns:
returns an instance pointing at the more specific record type requested
Throws:
CaptureFormatException - if the current record is not of the correct type for the conversion to take place