com.voytechs.jnetstream.primitive
Class HexdumpPrimitive

java.lang.Object
  extended by com.voytechs.jnetstream.primitive.AbstractAddressPrimitive
      extended by com.voytechs.jnetstream.primitive.HexdumpPrimitive
All Implemented Interfaces:
MutablePrimitive, Primitive, PrimitiveDisplay, PrimitiveFactory, ProtocolPrimitive, ProtocolPrimitiveFactory

public class HexdumpPrimitive
extends AbstractAddressPrimitive


Field Summary
static int BYTE_ORDER
           
static int DEFAULT_SIZE
           
static java.lang.String NAME
           
 
Fields inherited from class com.voytechs.jnetstream.primitive.AbstractAddressPrimitive
byteOrder, custom, format, name, radix, separator, sign, size, value
 
Fields inherited from interface com.voytechs.jnetstream.primitive.ProtocolPrimitive
BIG_ENDIAN, LITTLE_ENDIAN
 
Constructor Summary
HexdumpPrimitive()
           
HexdumpPrimitive(int size, boolean sign)
           
HexdumpPrimitive(int size, boolean sign, int byteOrder)
           
 
Method Summary
 Primitive buildPrimitive(int size, boolean sign)
           
 ProtocolPrimitive buildProtocolPrimitive(int size, boolean sign, int byteOrder)
           
protected  void checkBoundaries(java.lang.String name)
           
 java.lang.String getName()
           
 java.lang.Object getValue()
          Returns the value of this hexdump primitive as byte[].
 boolean isMultiLine()
           
 void setValue(PacketInputStream in)
          Sets the value of the primitive from packet stream.
 java.lang.String toBin(byte[] a)
           
 java.lang.String toString()
           
 java.lang.String toString(java.lang.String prefix, boolean indentFirstLine)
           
 
Methods inherited from class com.voytechs.jnetstream.primitive.AbstractAddressPrimitive
equals, getByteOrder, getRadix, getSign, getSize, hashCode, main, setCustom, setRadix, setSeparator, setSize, setValue, toBinString, write
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

NAME

public static final java.lang.String NAME
See Also:
Constant Field Values

DEFAULT_SIZE

public static final int DEFAULT_SIZE
See Also:
Constant Field Values

BYTE_ORDER

public static final int BYTE_ORDER
See Also:
Constant Field Values
Constructor Detail

HexdumpPrimitive

public HexdumpPrimitive()
Parameters:
-
Throws:

HexdumpPrimitive

public HexdumpPrimitive(int size,
                        boolean sign)
                 throws PrimitiveException
Throws:
PrimitiveException

HexdumpPrimitive

public HexdumpPrimitive(int size,
                        boolean sign,
                        int byteOrder)
                 throws PrimitiveException
Throws:
PrimitiveException
Method Detail

checkBoundaries

protected void checkBoundaries(java.lang.String name)
                        throws PrimitiveException
Overrides:
checkBoundaries in class AbstractAddressPrimitive
Throws:
PrimitiveException

setValue

public void setValue(PacketInputStream in)
              throws java.io.IOException,
                     EOPacket,
                     EOPacketStream,
                     PrimitiveException
Sets the value of the primitive from packet stream. Data is extracted according to the byte order specified. Also size number of bits are extracted. Note: Current implementation does not support non standard bit size in Little endian mode. That is sizes other then 32, 16, or 8 bits in little endian mode will throw an exception. This should be corrected in future releases. (Its hard to read bits in non big-endian order, but not impossible.)

Throws:
java.io.IOException
EOPacket
EOPacketStream
PrimitiveException

buildPrimitive

public Primitive buildPrimitive(int size,
                                boolean sign)
                         throws PrimitiveException
Throws:
PrimitiveException

buildProtocolPrimitive

public ProtocolPrimitive buildProtocolPrimitive(int size,
                                                boolean sign,
                                                int byteOrder)
                                         throws PrimitiveException
Throws:
PrimitiveException

isMultiLine

public boolean isMultiLine()
Specified by:
isMultiLine in interface PrimitiveDisplay
Overrides:
isMultiLine in class AbstractAddressPrimitive

toString

public java.lang.String toString()
Specified by:
toString in interface PrimitiveDisplay
Overrides:
toString in class AbstractAddressPrimitive

toString

public java.lang.String toString(java.lang.String prefix,
                                 boolean indentFirstLine)
Specified by:
toString in interface PrimitiveDisplay
Overrides:
toString in class AbstractAddressPrimitive

toBin

public java.lang.String toBin(byte[] a)
Overrides:
toBin in class AbstractAddressPrimitive

getValue

public java.lang.Object getValue()
Returns the value of this hexdump primitive as byte[].

Specified by:
getValue in interface Primitive
Overrides:
getValue in class AbstractAddressPrimitive
Returns:
byte[] buffer of all the data contained within this hexdump primitive.

getName

public java.lang.String getName()