- java.lang.Object
-
- java.lang.Number
-
- de.bernd_michaely.x3f.types.UnsignedInteger
-
- de.bernd_michaely.x3f.types.UInt32
-
- All Implemented Interfaces:
Serializable
,Comparable<UnsignedInteger>
public class UInt32 extends UnsignedInteger
Class for representing and handling of all 32 Bit values in the "FOVb" (X3F) file format specification.- See Also:
ByteArray
, Serialized Form
-
-
Field Summary
-
Fields inherited from class de.bernd_michaely.x3f.types.UnsignedInteger
uint32
-
-
Constructor Summary
Constructors Constructor Description UInt32()
Initializes this value with zero.UInt32(RandomAccessData randomAccessData)
Initializes this value by reading four unsigned bytes from the given data.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description double
doubleValue()
Returns this value interpreted as the bit representation of a float value.boolean
findPrefix(RandomAccessData randomAccessData, String prefix)
Searches the data source for a string prefix.boolean
findUnsigned32(RandomAccessData randomAccessData, long unsignedInteger32)
Searches the data source for a 32 bit value.float
floatValue()
Returns this value interpreted as the bit representation of a float value.String
getAsVersionString()
Returns this value as version string.void
readUnsigned32(RandomAccessData randomAccessData)
Sets this value by reading a little endian unsigned 32 bit value from the given data.protected void
reset()
Resets this value to zero.String
toString()
-
Methods inherited from class de.bernd_michaely.x3f.types.UnsignedInteger
byteValue, compareTo, equals, get16BitHigh, get16BitLow, getAsBitString, getAsByteArray, getByte, getUnsignedByteValue, hashCode, intValue, longValue, shortValue
-
-
-
-
Constructor Detail
-
UInt32
public UInt32()
Initializes this value with zero.
-
UInt32
public UInt32(RandomAccessData randomAccessData) throws RandomAccessDataException
Initializes this value by reading four unsigned bytes from the given data.- Parameters:
randomAccessData
- the data source to read from- Throws:
RandomAccessDataException
- if RandomAccessData source is invalid
-
-
Method Detail
-
reset
protected void reset()
Resets this value to zero.
-
floatValue
public float floatValue()
Returns this value interpreted as the bit representation of a float value. This is NOT to be confused with a type conversion of an int value to float!- Overrides:
floatValue
in classUnsignedInteger
- Returns:
- this value interpreted as the bit representation of a float value
- See Also:
Float.intBitsToFloat(int)
-
doubleValue
public double doubleValue()
Returns this value interpreted as the bit representation of a float value. This is NOT to be confused with a type conversion of an int value to double!- Overrides:
doubleValue
in classUnsignedInteger
- Returns:
- the same value as floatValue()
- See Also:
Float.intBitsToFloat(int)
,floatValue()
-
getAsVersionString
public String getAsVersionString()
Returns this value as version string. Example: "2.3" (without the quotes)- Returns:
- this value as version string
-
toString
public String toString()
- Overrides:
toString
in classUnsignedInteger
-
readUnsigned32
public void readUnsigned32(RandomAccessData randomAccessData) throws RandomAccessDataException
Sets this value by reading a little endian unsigned 32 bit value from the given data.- Parameters:
randomAccessData
- the data source to read from- Throws:
RandomAccessDataException
- if RandomAccessData source is invalid
-
findUnsigned32
public boolean findUnsigned32(RandomAccessData randomAccessData, long unsignedInteger32) throws RandomAccessDataException
Searches the data source for a 32 bit value. The data source offset will point to the first byte behind the found value by callingRandomAccessData.getCurrentOffset()
.- Parameters:
randomAccessData
- the data source to search inunsignedInteger32
- the unsigned 32 bit integer value to search for- Returns:
- true, iff the value was found
- Throws:
RandomAccessDataException
- if an error occurs during data accessNullPointerException
- if randomAccessData is null- Since:
- 2.0
-
findPrefix
public boolean findPrefix(RandomAccessData randomAccessData, String prefix) throws RandomAccessDataException
Searches the data source for a string prefix. The data source offset will point to the first byte behind the read four bytes containing the found prefix value by callingRandomAccessData.getCurrentOffset()
.- Parameters:
randomAccessData
- the data source to search inprefix
- the prefix to search for- Returns:
- true, iff the value was found
- Throws:
RandomAccessDataException
- (it does NOT throw anyRandomAccessEndOfDataException
s)NullPointerException
- if any of the arguments is null- Since:
- 2.0
-
-