Package com.voytechs.jnetstream.primitive

JNetStream primitive (datatypes) objects.

See:
          Description

Interface Summary
MutablePrimitive  
NumberPrimitive  
Primitive  
PrimitiveDisplay This interface deals with setting and getting properties that affect the display of the object.
PrimitiveFactory  
ProtocolPrimitive Interface which defines methods for interacting with Primtive at Protocol level.
ProtocolPrimitiveFactory  
 

Class Summary
AbstractAddressPrimitive  
AbstractNumberPrimitive  
AbstractStringPrimitive  
AbstractTimePrimitive  
AddressPrimitive  
BytePrimitive  
DNSNamePrimitive  
HexdumpPrimitive  
IntPrimitive  
IpAddressPrimitive  
IpNetmaskPrimitive  
LongPrimitive  
MacAddressPrimitive  
ShortPrimitive  
StringPrimitive  
TimePrimitive  
 

Exception Summary
PrimitiveException  
 

Package com.voytechs.jnetstream.primitive Description

JNetStream primitive (datatypes) objects. These objects are used by the codec and npl package to initialize datatypes in NPL and access contents of Packet/Header/Field codec objects. As an example the following primitives are very common and have been defined here:

  1. LongPrimitive
  2. IntPrimitive
  3. ShortPrimitive
  4. BytePrimitive
  5. AddressPrimitive
  6. IpAddressPrimitive - supports both V4 and V6 addresses
  7. MacAddressPrimitive
  8. DNSAddressPrimitive - resolves compressed DNS addresses by following pointers.
  9. StringAddressPrimitive
  10. HexdumpPrimitive - a hexadecimal dump of any number of bytes with their ASCII encoding shown on the side.
  11. TextPrimitive - Similar to HexdumpPrimitive a hexadecimal dump of any number of bytes with their ASCII encoding shown on the side.
Various accessor and getter methods are available to get at the data continained within the Primitive. Also various comparison and comparable interfaces are implemented to allow data manipulation and comparisons.

Packet packet = decoder.nextPacket();
Primitive primitive = packet.getHeader("IPv4").getField("src");
IpAddress address = null;
if(primitive != null)
        address = (IpAddress)primitive.getValue();

IpNetwork network = new IpNetwork("132.145.167.0", 24);

if(network.isPartOf(address) == true) // Could also do: equals(), compareTo(), put in a sorted map or tree, etc...
        System.out.println(address.toString() + " is part of " + network.toString());
else
        System.out.println(address.toString() + " is NOT part of " + network.toString());