com.voytechs.jnetstream.primitive
Class StringPrimitive

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

public class StringPrimitive
extends AbstractStringPrimitive


Field Summary
static int BYTE_ORDER
           
static int DEFAULT_SIZE
           
static java.lang.String NAME
           
 
Fields inherited from class com.voytechs.jnetstream.primitive.AbstractStringPrimitive
byteOrder, custom, name, radix, sign, SIGN, size, value
 
Fields inherited from interface com.voytechs.jnetstream.primitive.ProtocolPrimitive
BIG_ENDIAN, LITTLE_ENDIAN
 
Constructor Summary
StringPrimitive()
           
StringPrimitive(int size, boolean sign)
           
StringPrimitive(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()
           
 boolean isMultiLine()
           
static void main(java.lang.String[] args)
          Test function for StringPrimitive
 void setValue(PacketInputStream in)
          Sets the value of the primitive from packet stream.
 void setValue(java.lang.String value)
           
 java.lang.String toString()
           
 java.lang.String toString(java.lang.String prefix, boolean indentFirstLine)
           
 
Methods inherited from class com.voytechs.jnetstream.primitive.AbstractStringPrimitive
compareTo, getByteOrder, getRadix, getSign, getSize, getValue, hashCode, prefixWithZeros, setCustom, setRadix, setSize, setValue, toBinString, write
 
Methods inherited from class java.lang.Object
clone, equals, 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

StringPrimitive

public StringPrimitive()
Parameters:
-
Throws:

StringPrimitive

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

StringPrimitive

public StringPrimitive(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 AbstractStringPrimitive
Throws:
PrimitiveException

setValue

public void setValue(java.lang.String value)

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

toString

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

toString

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

isMultiLine

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

main

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

Parameters:
args - command line arguments

getName

public java.lang.String getName()