com.voytechs.jnetstream.primitive
Interface ProtocolPrimitive

All Superinterfaces:
Primitive
All Known Implementing Classes:
AbstractAddressPrimitive, AbstractNumberPrimitive, AbstractStringPrimitive, AbstractTimePrimitive, AddressPrimitive, BytePrimitive, DNSNamePrimitive, HexdumpPrimitive, IntPrimitive, IpAddressPrimitive, IpNetmaskPrimitive, LongPrimitive, MacAddressPrimitive, ShortPrimitive, StringPrimitive, TimePrimitive

public interface ProtocolPrimitive
extends Primitive

Interface which defines methods for interacting with Primtive at Protocol level. Primitive is aware of streams and network byte-order which are attributes of a primitive related to protocol communication.



Field Summary
static int BIG_ENDIAN
          Data is encoded in BIG endian order (first byte is most significant.)
static int LITTLE_ENDIAN
          Data is encoded in LITTLE endian order (first byte is least significant.)
 
Method Summary
 int getByteOrder()
          Use the getByteOrder() method to get the byte order encoding of the data.
 void setValue(PacketInputStream in)
          Sets the value of this primitive from the PacketStream.
 void write(PacketOutputStream out)
          Writes curent value of this primitive to the PacketStream.
 
Methods inherited from interface com.voytechs.jnetstream.primitive.Primitive
getSign, getSize, getValue
 

Field Detail

BIG_ENDIAN

static final int BIG_ENDIAN
Data is encoded in BIG endian order (first byte is most significant.)

See Also:
Constant Field Values

LITTLE_ENDIAN

static final int LITTLE_ENDIAN
Data is encoded in LITTLE endian order (first byte is least significant.)

See Also:
Constant Field Values
Method Detail

getByteOrder

int getByteOrder()
Use the getByteOrder() method to get the byte order encoding of the data. Although internally all values are converted to Java network order (BIG Endian), this is more important for reading and writting to PacketStreams.


setValue

void setValue(PacketInputStream in)
              throws java.io.IOException,
                     EOPacket,
                     EOPacketStream,
                     PrimitiveException
Sets the value of this primitive from the PacketStream. This method utiltizes the getSize(), getSign() and getByteOrder() methods to properly read from the PacketStream.

Parameters:
out - PacketInputStream to read the value of this primitive from.
Throws:
java.io.IOException
EOPacket
EOPacketStream
PrimitiveException

write

void write(PacketOutputStream out)
           throws java.io.IOException,
                  PrimitiveException
Writes curent value of this primitive to the PacketStream. This method utiltizes the getSize(), getSign() and getByteOrder() methods to properly write to the PacketStream.

Parameters:
out - PacketOutputStream to write the value of this primitive to.
Throws:
java.io.IOException - If any I/O errors.
PrimitiveException - If any primitive incompatibilities araise.