com.voytechs.jnetstream.primitive
Class AbstractAddressPrimitive
java.lang.Object
com.voytechs.jnetstream.primitive.AbstractAddressPrimitive
- All Implemented Interfaces:
- MutablePrimitive, Primitive, PrimitiveDisplay, PrimitiveFactory, ProtocolPrimitive, ProtocolPrimitiveFactory
- Direct Known Subclasses:
- AddressPrimitive, HexdumpPrimitive, IpAddressPrimitive, IpNetmaskPrimitive, MacAddressPrimitive
public abstract class AbstractAddressPrimitive
- extends java.lang.Object
- implements ProtocolPrimitive, ProtocolPrimitiveFactory, PrimitiveDisplay, MutablePrimitive
| Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
size
protected int size
sign
protected boolean sign
radix
protected int radix
byteOrder
protected int byteOrder
value
protected Address value
separator
protected char separator
format
protected char[] format
custom
protected Primitive custom
name
protected java.lang.String name
AbstractAddressPrimitive
public AbstractAddressPrimitive(int size)
AbstractAddressPrimitive
public AbstractAddressPrimitive(int size,
int byteOrder)
- Parameters:
-
- Throws:
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
getSign
public boolean getSign()
- Specified by:
getSign in interface Primitive
getRadix
public int getRadix()
- Specified by:
getRadix in interface PrimitiveDisplay
setSeparator
public void setSeparator(char sep)
setCustom
public void setCustom(Primitive custom)
- Specified by:
setCustom in interface MutablePrimitive
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
setValue
public void setValue(java.lang.Object value)
- Specified by:
setValue in interface MutablePrimitive
setSize
public void setSize(int size)
throws PrimitiveException
- Specified by:
setSize in interface MutablePrimitive
- 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
toString
public java.lang.String toString(java.lang.String prefix,
boolean indentFirstLine)
- Specified by:
toString in interface PrimitiveDisplay
toBinString
public java.lang.String toBinString()
- Specified by:
toBinString in interface PrimitiveDisplay
toBin
public java.lang.String toBin(byte[] a)
equals
public boolean equals(java.lang.Object v)
- Overrides:
equals in class java.lang.Object
write
public void write(PacketOutputStream out)
throws java.io.IOException,
PrimitiveException
- Base implementation for Address based primtives which writes out the
primitive value to PacketOutpuStream.
- 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 AbstractAddressPrimitive
- Parameters:
args - command line arguments