com.voytechs.jnetstream.io
Class PacketBuffer

java.lang.Object
  extended by java.io.InputStream
      extended by com.voytechs.jnetstream.io.ProtocolDataInputStream
          extended by com.voytechs.jnetstream.io.PacketInputStream
              extended by com.voytechs.jnetstream.io.PacketBuffer
All Implemented Interfaces:
java.io.Closeable

public class PacketBuffer
extends PacketInputStream

Converts a MarkerBuffer into a PacketInputStream so it can be used in conjunction with the decoder.

Since:
0.2.2
Author:
Mark Bednarczyk

Nested Class Summary
 
Nested classes/interfaces inherited from class com.voytechs.jnetstream.io.PacketInputStream
PacketInputStream.BufferedHeader
 
Field Summary
 
Fields inherited from class com.voytechs.jnetstream.io.PacketInputStream
captureDeviceArch, captureDeviceFilename, captureDeviceIp, captureDeviceOS, captureLive, debugHeaders, fileHeader, linkType, packetCaptureTimestamp, packetEnd, packetLength, packetSnaplen, packetStart, recordEnd, recordHeader, recordLength, recordStart, stackIn
 
Fields inherited from class com.voytechs.jnetstream.io.ProtocolDataInputStream
bitsLeft, in
 
Constructor Summary
PacketBuffer(MarkerBuffer buffer, java.lang.String firstHeader)
          Initialize the Packet Buffer as PacketInputStream.
 
Method Summary
protected  void init()
          Initialize PacketInputStream attributes to make this hole thing work.
 void nextPacket()
          Prep the stream for next packet in the buffer.
 
Methods inherited from class com.voytechs.jnetstream.io.PacketInputStream
bitsLeft, clear, getCaptureDeviceAddress, getCaptureDeviceArch, getCaptureDeviceFilename, getCaptureDeviceIp, getCaptureDeviceOS, getCaptureTimestamp, getFileFormatName, getFileHeader, getLinkType, getPacketEnd, getPacketLength, getPacketLengthRemaining, getPacketSnaplen, getPacketStart, getPaddingLength, getRecordEnd, getRecordHeader, getRecordHeaderLength, getRecordLength, getRecordStart, goToEndOfRecord, gotoMark, hasForceRead, hex, initPacketStream, initRecordHeader, isCaptureLive, isCompressed, isDebugHeaders, isPacketReady, isReady, isReady, main, pop, position, printStream, push, push, read, setCaptureTimestamp, setCompressed, setDebugHeaders, setForceRead, setIncludePadding, setLinkType, setPacketLength, setPacketSnaplen, setPacketStart, setRecordLength, setRecordStart, skip
 
Methods inherited from class com.voytechs.jnetstream.io.ProtocolDataInputStream
readBits, readBitsLong, readBoolean, readByte, readerUnsignedLongLittleEndian, readFromPacket, readFromPacket, readInt, readIntLittleEndian, readLong, readLongLittleEndian, readShort, readShortLittleEndian, readUnsignedByte, readUnsignedInt, readUnsignedIntLittleEndian, readUnsignedLong, 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, toString, wait, wait, wait
 

Constructor Detail

PacketBuffer

public PacketBuffer(MarkerBuffer buffer,
                    java.lang.String firstHeader)
             throws java.io.IOException,
                    EOPacketStream,
                    StreamFormatException
Initialize the Packet Buffer as PacketInputStream.

Parameters:
buffer - buffer which contains the packet dataq.
firstHeader - name of the first header in this buffer. i.e. "UDP"
Throws:
java.io.IOException - any IO errors.
EOPacketStream - incase end of packet in the stream is reached.
StreamFormatException - if the input stream is not formatted correctly.
Method Detail

init

protected void init()
Initialize PacketInputStream attributes to make this hole thing work.


nextPacket

public void nextPacket()
                throws java.io.IOException,
                       EOPacketStream,
                       StreamFormatException
Prep the stream for next packet in the buffer.

Overrides:
nextPacket in class PacketInputStream
Throws:
java.io.IOException - any IO errors.
EOPacketStream - incase end of packet in the stream is reached.
StreamFormatException - if the input stream is not formatted correctly.