Package org.openmuc.framework.data
Class ByteArrayValue
- java.lang.Object
-
- org.openmuc.framework.data.ByteArrayValue
-
-
Constructor Summary
Constructors Constructor Description ByteArrayValue(byte[] value)Create a new ByteArrayValue whose internal byte array will be a reference to thevaluepassed to this constructor.ByteArrayValue(byte[] value, boolean copy)Creates a new ByteArrayValue copying the byte array passed ifcopyis true.ByteArrayValue(java.lang.String hexStringValue)Creates a new ByteArrayValue from a String in type [012345] or 0x012345.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanasBoolean()Returns the value as a boolean.byteasByte()Returns the value as a byte.byte[]asByteArray()Returns the value as a byte array.doubleasDouble()Returns the value as a double.floatasFloat()Returns the value as a float.intasInt()Returns the value as an integer.longasLong()Returns the value as a long.shortasShort()Returns the value as a short.java.lang.StringasString()Returns the value as a string.booleanequals(java.lang.Object o)ValueTypegetValueType()Returns theValueTypeinthashCode()java.lang.StringtoString()
-
-
-
Constructor Detail
-
ByteArrayValue
public ByteArrayValue(byte[] value)
Create a new ByteArrayValue whose internal byte array will be a reference to thevaluepassed to this constructor. That means the passed byte array is not copied. Therefore you should not change the contents of value after calling this constructor. If you want ByteArrayValue to internally store a copy of the passed value then you should use the other constructor of this class instead.- Parameters:
value- the byte array value.
-
ByteArrayValue
public ByteArrayValue(byte[] value, boolean copy)Creates a new ByteArrayValue copying the byte array passed ifcopyis true.- Parameters:
value- the byte array value.copy- if true it will internally store a copy of value, else it will store a reference to value.
-
ByteArrayValue
public ByteArrayValue(java.lang.String hexStringValue)
Creates a new ByteArrayValue from a String in type [012345] or 0x012345.- Parameters:
hexStringValue- the byte array value as string.
-
-
Method Detail
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
asDouble
public double asDouble()
Description copied from interface:ValueReturns the value as a double.
-
asFloat
public float asFloat()
Description copied from interface:ValueReturns the value as a float.
-
asLong
public long asLong()
Description copied from interface:ValueReturns the value as a long.
-
asInt
public int asInt()
Description copied from interface:ValueReturns the value as an integer.
-
asShort
public short asShort()
Description copied from interface:ValueReturns the value as a short.
-
asByte
public byte asByte()
Description copied from interface:ValueReturns the value as a byte.
-
asBoolean
public boolean asBoolean()
Description copied from interface:ValueReturns the value as a boolean.
-
asByteArray
public byte[] asByteArray()
Description copied from interface:ValueReturns the value as a byte array.- Specified by:
asByteArrayin interfaceValue- Returns:
- the value as a byte array
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
asString
public java.lang.String asString()
Description copied from interface:ValueReturns the value as a string.
-
getValueType
public ValueType getValueType()
Description copied from interface:ValueReturns theValueType- Specified by:
getValueTypein interfaceValue- Returns:
- ValueType of this value
-
-