com.voytechs.jnetstream.primitive
Class AbstractTimePrimitive
java.lang.Object
com.voytechs.jnetstream.primitive.AbstractTimePrimitive
- All Implemented Interfaces:
- MutablePrimitive, Primitive, PrimitiveDisplay, PrimitiveFactory, ProtocolPrimitive, ProtocolPrimitiveFactory
- Direct Known Subclasses:
- TimePrimitive
public abstract class AbstractTimePrimitive
- extends java.lang.Object
- implements ProtocolPrimitive, ProtocolPrimitiveFactory, PrimitiveDisplay, MutablePrimitive
| Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
SIGN
public static final boolean SIGN
- See Also:
- Constant Field Values
maxSize
protected int maxSize
size
protected int size
byteOrder
protected int byteOrder
sign
protected boolean sign
radix
protected int radix
custom
protected Primitive custom
value
protected java.sql.Timestamp value
name
protected java.lang.String name
AbstractTimePrimitive
public AbstractTimePrimitive(int maxSize,
int size,
boolean sign)
AbstractTimePrimitive
public AbstractTimePrimitive(int maxSize,
int size,
boolean sign,
int byteOrder)
- Parameters:
-
- Throws:
setValue
public void setValue(java.lang.Object value)
- Specified by:
setValue in interface MutablePrimitive
setCustom
public void setCustom(Primitive custom)
- Specified by:
setCustom in interface MutablePrimitive
getByteOrder
public int getByteOrder()
- Description copied from interface:
ProtocolPrimitive
- 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.
- Specified by:
getByteOrder in interface ProtocolPrimitive
getSize
public int getSize()
- Specified by:
getSize in interface Primitive
setSize
public void setSize(int size)
throws PrimitiveException
- Specified by:
setSize in interface MutablePrimitive
- Throws:
PrimitiveException
getSign
public boolean getSign()
- Specified by:
getSign in interface Primitive
getRadix
public int getRadix()
- Specified by:
getRadix in interface PrimitiveDisplay
setRadix
public void setRadix(int radix)
- Specified by:
setRadix in interface PrimitiveDisplay
getValue
public java.lang.Object getValue()
- Specified by:
getValue in interface Primitive
checkBoundaries
protected void checkBoundaries(java.lang.String name)
throws PrimitiveException
- Throws:
PrimitiveException
isMultiLine
public boolean isMultiLine()
- Specified by:
isMultiLine in interface PrimitiveDisplay
toString
public java.lang.String toString()
- Specified by:
toString in interface PrimitiveDisplay- Overrides:
toString in class java.lang.Object
toBinString
public java.lang.String toBinString()
- Specified by:
toBinString in interface PrimitiveDisplay
toString
public java.lang.String toString(java.lang.String prefix,
boolean indentFirstLine)
- Specified by:
toString in interface PrimitiveDisplay
prefixWithZeros
public static java.lang.String prefixWithZeros(long v,
int size)
equals
public boolean equals(java.lang.Object v)
- Overrides:
equals in class java.lang.Object
compareTo
public int compareTo(java.lang.Object v)
write
public void write(PacketOutputStream out)
throws java.io.IOException,
PrimitiveException
- Base implementation for Time based primtives which writes out the
primitive value to PacketOutpuStream.
Both the time portion and nanos are written out.
- Specified by:
write in interface ProtocolPrimitive
- Parameters:
out - OutputStream to write out the address primitive.
- Throws:
java.io.IOException - If any I/O errors.
PrimitiveException - If any primitive incompatibilities araise.
hashCode
public int hashCode()
- We need to override this method so that we can do Hashtable lookups on different Primitive
object types.
- Overrides:
hashCode in class java.lang.Object
main
public static void main(java.lang.String[] args)
- Test function for AbstractTimePrimitive
- Parameters:
args - command line arguments