com.voytechs.jnetstream.io.meta
Class CaptureMetaEnumerator

java.lang.Object
  extended by com.voytechs.jnetstream.io.meta.CaptureMetaEnumerator
All Implemented Interfaces:
java.util.Enumeration

public class CaptureMetaEnumerator
extends java.lang.Object
implements java.util.Enumeration

This is a support object to help enumerate META data received from parsing Capture files using NPL parser such as RawformatInputStream.

This object returns one (1) META value at a time following the Enumeration interface. Use methods add() to add META values and use nextElement() to retrieve the front META value. Values are added and retrieved on FIFO model (First in First out).


Constructor Summary
CaptureMetaEnumerator()
           
 
Method Summary
 void add(Field data)
          Adds new META data in form of a Field to the FIFO queue.
 void add(Header metaFields)
          Adds meta information to the FIFO queue.
 void add(Packet metaFields)
          Adds meta information to the FIFO queue.
 boolean hasMoreElements()
          Returns true of there are more META values to be returned.
static void main(java.lang.String[] args)
          Test function for CaptureMetaEnumerator
 java.lang.Object nextElement()
          Returns the next META value.
 MetaValue nextMetaValue()
          A conveniece function, not part of Enumeration API, which type casts to MetaValue instead of returning Object.
 void removeAll()
          Drains the FIFO queue to empty.
 java.lang.String toString()
          Returns the String representation of all the META values.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CaptureMetaEnumerator

public CaptureMetaEnumerator()
Parameters:
-
Throws:
Method Detail

hasMoreElements

public boolean hasMoreElements()
Returns true of there are more META values to be returned.

Specified by:
hasMoreElements in interface java.util.Enumeration
Returns:
Tells if there are more META values to be returned.

nextElement

public java.lang.Object nextElement()
Returns the next META value.

Specified by:
nextElement in interface java.util.Enumeration
Returns:
Next meta value returned in FIFO sequence.

nextMetaValue

public MetaValue nextMetaValue()
A conveniece function, not part of Enumeration API, which type casts to MetaValue instead of returning Object. Both nextMetaValue() and nextElement() methods return the same values.

Returns:
Next meta value returned in FIFO sequence.
See Also:
nextElement()

add

public void add(Field data)
Adds new META data in form of a Field to the FIFO queue. Sub-fields of Fields are not processed as their top-level ancestor carries the required numerical value.

If somehow the values of sub-fields are also relavent, then they need to be added manually by making separate calls to add(Field) method.

Parameters:
data - Adds a Field element to the meta data FIFO queue.
See Also:
Field

add

public void add(Header metaFields)
Adds meta information to the FIFO queue. Data is extracted from Header as each Field is added to the META FIFO queue.

Each Field is extracted from the header and added as individual META value.

Parameters:
metaFields - Header from which to extract META values, one (1) for each Field within the Header. Fields are extracted in suquencial order.
See Also:
Field, Header

add

public void add(Packet metaFields)
Adds meta information to the FIFO queue. Data is extracted from packets as each Field is added to the META FIFO queue. Each header is extracted and each of its fields added in sequence.

Each Field is extracted from the packet and added as individual META value.

Parameters:
metaFields - Packet from which to extract META values, one (1) for each Field within the Packet. Fields are extracted in suquencial order.
See Also:
Field, Packet

removeAll

public void removeAll()
Drains the FIFO queue to empty.


toString

public java.lang.String toString()
Returns the String representation of all the META values.

Overrides:
toString in class java.lang.Object

main

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

Parameters:
args - command line arguments