com.voytechs.jnetstream.primitive
Class StringPrimitive
java.lang.Object
com.voytechs.jnetstream.primitive.AbstractStringPrimitive
com.voytechs.jnetstream.primitive.StringPrimitive
- All Implemented Interfaces:
- MutablePrimitive, Primitive, PrimitiveDisplay, PrimitiveFactory, ProtocolPrimitive, ProtocolPrimitiveFactory
public class StringPrimitive
- extends AbstractStringPrimitive
| 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 |
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
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
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()