Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

com.voytechs.jnetstream.io
Class RawformatInputStream  view RawformatInputStream download RawformatInputStream.java

java.lang.Object
  extended byjava.io.InputStream
      extended bycom.voytechs.jnetstream.io.ProtocolDataInputStream
          extended bycom.voytechs.jnetstream.io.PacketInputStream
              extended bycom.voytechs.jnetstream.io.RawformatInputStream
All Implemented Interfaces:
java.io.Closeable

public class RawformatInputStream
extends PacketInputStream


Field Summary
private static boolean debug
           
protected  com.voytechs.jnetstream.codec.Decoder decoder
          The decoder used to decode capture file headers.
static java.lang.String FILE_HEADER
           
static java.lang.String FILE_RECORDLEN
           
static java.lang.String FILE_TYPENAME
           
static java.lang.String INTERFACE_DROPS
           
static java.lang.String INTERFACE_ERROR
           
static java.lang.String INTERFACE_IN
           
static java.lang.String INTERFACE_OUT
           
static int MAX_PACKET_LENGTH
           
static java.lang.String PACKET_HEADER_POSTFIX
           
static java.lang.String PACKET_LENGTH
           
static java.lang.String PACKET_LINKTYPE
           
static java.lang.String PACKET_MICROS
           
static java.lang.String PACKET_SECONDS
           
static java.lang.String PACKET_SNAPLEN
           
protected  java.lang.String packetHeader
           
 
Fields inherited from class com.voytechs.jnetstream.io.PacketInputStream
captureDeviceArch, captureDeviceFilename, captureDeviceIp, captureDeviceOS, captureLive, linkType, packetCaptureTimestamp, packetEnd, packetLength, packetSnaplen, packetStart, recordEnd, recordLength, recordStart, stackIn
 
Fields inherited from class com.voytechs.jnetstream.io.ProtocolDataInputStream
bitsLeft, in
 
Constructor Summary
RawformatInputStream(java.io.InputStream rawFileFormatInputStream, java.lang.String nplFormatFile)
           
RawformatInputStream(java.lang.String captureFile, java.lang.String nplFormatFile)
          Opens up the given file and starts processing the data.
 
Method Summary
protected  void extractValues(com.voytechs.jnetstream.codec.Packet packet)
           
protected  void initPacketStream()
          Since we know we are dealing with a Snoop-file formatted stream (i.e.
static void main(java.lang.String[] args)
          Test function for RawformatInputStream
protected  void readPacketPreHeader()
          Read pre-packet header from stream.
 java.lang.String toString()
          Convert this Object to a human-readable String.
 
Methods inherited from class com.voytechs.jnetstream.io.PacketInputStream
bitsLeft, clear, getCaptureDeviceAddress, getCaptureDeviceArch, getCaptureDeviceFilename, getCaptureDeviceIp, getCaptureDeviceOS, getCaptureTimestamp, getLinkType, getPacketEnd, getPacketLength, getPacketLengthRemaining, getPacketSnaplen, getPacketStart, getRecordEnd, getRecordHeaderLength, getRecordLength, getRecordStart, goToEndOfRecord, gotoMark, hasForceRead, hex, isCaptureLive, isPacketReady, isReady, isReady, nextPacket, pop, position, printStream, push, push, read, setCaptureTimestamp, setForceRead, setLinkType, setPacketLength, setPacketSnaplen, setPacketStart, setRecordLength, setRecordStart, skip
 
Methods inherited from class com.voytechs.jnetstream.io.ProtocolDataInputStream
readBits, readBitsLong, readBoolean, readByte, readFromPacket, readFromPacket, readInt, readIntLittleEndian, readLong, readLongLittleEndian, readShort, readShortLittleEndian, readUnsignedByte, readUnsignedInt, readUnsignedIntLittleEndian, readUnsignedShort, readUnsignedShortLittleEndian, reThrow
 
Methods inherited from class java.io.InputStream
available, close, mark, markSupported, read, read, reset
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

debug

private static final boolean debug
See Also:
Constant Field Values

FILE_HEADER

public static final java.lang.String FILE_HEADER
See Also:
Constant Field Values

PACKET_HEADER_POSTFIX

public static final java.lang.String PACKET_HEADER_POSTFIX
See Also:
Constant Field Values

MAX_PACKET_LENGTH

public static final int MAX_PACKET_LENGTH
See Also:
Constant Field Values

FILE_TYPENAME

public static final java.lang.String FILE_TYPENAME
See Also:
Constant Field Values

FILE_RECORDLEN

public static final java.lang.String FILE_RECORDLEN
See Also:
Constant Field Values

PACKET_LINKTYPE

public static final java.lang.String PACKET_LINKTYPE
See Also:
Constant Field Values

PACKET_LENGTH

public static final java.lang.String PACKET_LENGTH
See Also:
Constant Field Values

PACKET_SNAPLEN

public static final java.lang.String PACKET_SNAPLEN
See Also:
Constant Field Values

PACKET_SECONDS

public static final java.lang.String PACKET_SECONDS
See Also:
Constant Field Values

PACKET_MICROS

public static final java.lang.String PACKET_MICROS
See Also:
Constant Field Values

INTERFACE_DROPS

public static final java.lang.String INTERFACE_DROPS
See Also:
Constant Field Values

INTERFACE_IN

public static final java.lang.String INTERFACE_IN
See Also:
Constant Field Values

INTERFACE_OUT

public static final java.lang.String INTERFACE_OUT
See Also:
Constant Field Values

INTERFACE_ERROR

public static final java.lang.String INTERFACE_ERROR
See Also:
Constant Field Values

decoder

protected com.voytechs.jnetstream.codec.Decoder decoder
The decoder used to decode capture file headers.


packetHeader

protected java.lang.String packetHeader
Constructor Detail

RawformatInputStream

public RawformatInputStream(java.io.InputStream rawFileFormatInputStream,
                            java.lang.String nplFormatFile)
                     throws java.io.IOException,
                            EOPacketStream,
                            StreamFormatException,
                            com.voytechs.jnetstream.npl.SyntaxError

RawformatInputStream

public RawformatInputStream(java.lang.String captureFile,
                            java.lang.String nplFormatFile)
                     throws java.io.FileNotFoundException,
                            java.io.IOException,
                            EOPacketStream,
                            StreamFormatException,
                            com.voytechs.jnetstream.npl.SyntaxError
Opens up the given file and starts processing the data.

Method Detail

initPacketStream

protected void initPacketStream()
                         throws java.io.IOException,
                                EOPacketStream,
                                StreamFormatException
Since we know we are dealing with a Snoop-file formatted stream (i.e. FileInputStream("raw-capturefile.raw")) we initialize the ProtocolInputStream using values extracted from the raw stream. First we extract the "raw_file_heaer" as specified above.

Overrides:
initPacketStream in class PacketInputStream

readPacketPreHeader

protected void readPacketPreHeader()
                            throws java.io.IOException,
                                   EOPacketStream,
                                   StreamFormatException
Read pre-packet header from stream. With basic info about the next packet to follow. this is called for every packet in the stream. Main purpose is to get packet-data length (or length of captured packet) and the capture time of the packet.

Overrides:
readPacketPreHeader in class PacketInputStream

extractValues

protected void extractValues(com.voytechs.jnetstream.codec.Packet packet)
                      throws StreamFormatException

toString

public java.lang.String toString()
Description copied from class: java.lang.Object
Convert this Object to a human-readable String. There are no limits placed on how long this String should be or what it should contain. We suggest you make it as intuitive as possible to be able to place it into System.out.println() 55 and such.

It is typical, but not required, to ensure that this method never completes abruptly with a java.lang.RuntimeException.

This method will be called when performing string concatenation with this object. If the result is null, string concatenation will instead use "null".

The default implementation returns getClass().getName() + "@" + Integer.toHexString(hashCode()).


main

public static void main(java.lang.String[] args)
Test function for RawformatInputStream