com.voytechs.jnetstream.io
Class DefaultPacketCounter

java.lang.Object
  extended by com.slytechs.jnetstream.file.PacketCounter
      extended by com.voytechs.jnetstream.io.DefaultPacketCounter

public class DefaultPacketCounter
extends PacketCounter

Author:
Mark Bednarczyk, Sly Technologies, Inc.

Field Summary
 
Fields inherited from class com.slytechs.jnetstream.file.PacketCounter
DEFAULT_FORCED_COUNT_STATE
 
Constructor Summary
DefaultPacketCounter(java.io.File file)
           
DefaultPacketCounter(java.io.File file, PacketCounterModel model)
           
 
Method Summary
 long getAccuratePacketCount()
           
 long getAccuratePacketCount(long limit)
           
 long getCount()
          Gets the true and accurate count of the number of packets in the file.
 long getCount(long limit)
          Gets the true and accurate count of the number of packets in the file.
 long getMaxPacketCount()
           
 PacketCounterModel getModel()
          Returns the model that is being used by this packet counter.
 long getStatisticalPacketCount(double ganularity, long samples)
           
 PacketCounterModel validateModel(java.io.File file, PacketCounterModel model)
           
 
Methods inherited from class com.slytechs.jnetstream.file.PacketCounter
newInstance, newInstance
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultPacketCounter

public DefaultPacketCounter(java.io.File file,
                            PacketCounterModel model)
                     throws java.io.FileNotFoundException,
                            StreamFormatException
Throws:
java.io.UnsupportedEncodingException
StreamFormatException
java.io.FileNotFoundException

DefaultPacketCounter

public DefaultPacketCounter(java.io.File file)
                     throws java.io.FileNotFoundException,
                            StreamFormatException
Parameters:
file -
Throws:
java.io.UnsupportedEncodingException
StreamFormatException
java.io.FileNotFoundException
Method Detail

validateModel

public PacketCounterModel validateModel(java.io.File file,
                                        PacketCounterModel model)

getAccuratePacketCount

public long getAccuratePacketCount()
                            throws java.io.IOException
Throws:
java.io.IOException

getAccuratePacketCount

public long getAccuratePacketCount(long limit)
                            throws java.io.IOException
Throws:
java.io.IOException

getStatisticalPacketCount

public long getStatisticalPacketCount(double ganularity,
                                      long samples)
                               throws java.io.IOException
Throws:
java.io.IOException

getMaxPacketCount

public long getMaxPacketCount()

getCount

public long getCount()
              throws java.io.IOException
Description copied from class: PacketCounter
Gets the true and accurate count of the number of packets in the file. This operation can be very expensive in terms of IO and time since some capture files can be very very large.

Specified by:
getCount in class PacketCounter
Returns:
Accurate packet count.
Throws:
java.io.IOException

getCount

public long getCount(long limit)
              throws java.io.IOException
Description copied from class: PacketCounter
Gets the true and accurate count of the number of packets in the file. This operation can be very expensive in terms of IO and time since some capture files can be very very large.

Specified by:
getCount in class PacketCounter
Parameters:
limit - limit counting packets to maximimum set upto this limit.
Returns:
Accurate packet count.
Throws:
java.io.IOException

getModel

public PacketCounterModel getModel()
Description copied from class: PacketCounter
Returns the model that is being used by this packet counter. The model may differ from the model that was initialy requested by the user or from default. The packet counter switches models based on conditions and resource parameters to fulfill the request.

Specified by:
getModel in class PacketCounter
Returns:
Returns the model.