com.voytechs.jnetstream.primitive
Class IntPrimitive
java.lang.Object
com.voytechs.jnetstream.primitive.AbstractNumberPrimitive
com.voytechs.jnetstream.primitive.IntPrimitive
- All Implemented Interfaces:
- MutablePrimitive, NumberPrimitive, Primitive, PrimitiveDisplay, PrimitiveFactory, ProtocolPrimitive, ProtocolPrimitiveFactory
public class IntPrimitive
- extends AbstractNumberPrimitive
| Methods inherited from class com.voytechs.jnetstream.primitive.AbstractNumberPrimitive |
checkBoundaries, compareTo, equals, getByteOrder, getRadix, getSign, getSize, getValue, hashCode, isMultiLine, longValue, prefixWithZeros, setCustom, setRadix, setSize, setValue, toBinString, toString, toString |
| Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
NAME
public static final java.lang.String NAME
- See Also:
- Constant Field Values
MAX_SIZE
public static final int MAX_SIZE
- See Also:
- Constant Field Values
BYTE_ORDER
public static final int BYTE_ORDER
- See Also:
- Constant Field Values
IntPrimitive
public IntPrimitive()
- Parameters:
-
- Throws:
IntPrimitive
public IntPrimitive(int size,
boolean sign)
throws PrimitiveException
- Throws:
PrimitiveException
IntPrimitive
public IntPrimitive(int size,
boolean sign,
int byteOrder)
throws PrimitiveException
- Throws:
PrimitiveException
setValue
public void setValue(int value)
setValue
public void setValue(java.lang.Integer 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
write
public void write(PacketOutputStream out)
throws java.io.IOException,
PrimitiveException
- Writes the value to the OutputStream.
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.)
- Parameters:
out - OutputStream to write our data value.
- Throws:
java.io.IOException - If any I/O errors.
PrimitiveException - If any primitive incompatibilities araise.
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
main
public static void main(java.lang.String[] args)
- Test function for IntPrimitive
- Parameters:
args - command line arguments
getName
public java.lang.String getName()