Package gov.nasa.pds.objectAccess.array
Class IntegerAdapter
java.lang.Object
gov.nasa.pds.objectAccess.array.IntegerAdapter
- All Implemented Interfaces:
DataTypeAdapter
public class IntegerAdapter extends Object implements DataTypeAdapter
Implements a data type adapter for 4-byte integers.
-
Constructor Summary
Constructors Constructor Description IntegerAdapter(int elementSize, boolean isBigEndian, boolean isUnsigned)Creates a new adapter for an integer of given size. -
Method Summary
Modifier and Type Method Description doublegetDouble(ByteBuffer buf)Gets the value as a double.intgetInt(ByteBuffer buf)Gets the value as an int.longgetLong(ByteBuffer buf)Gets the value as a long.
-
Constructor Details
-
IntegerAdapter
public IntegerAdapter(int elementSize, boolean isBigEndian, boolean isUnsigned)Creates a new adapter for an integer of given size.- Parameters:
elementSize- the number of bytes in the integerisBigEndian- true, if the data is big-endian, false if little-endianisUnsigned- true, if the data is unsigned, false if signed
-
-
Method Details
-
getInt
Description copied from interface:DataTypeAdapterGets the value as an int.- Specified by:
getIntin interfaceDataTypeAdapter- Parameters:
buf- the buffer from which to get the value- Returns:
- the value, as an int
-
getLong
Description copied from interface:DataTypeAdapterGets the value as a long.- Specified by:
getLongin interfaceDataTypeAdapter- Parameters:
buf- the buffer from which to get the value- Returns:
- the value, as a long
-
getDouble
Description copied from interface:DataTypeAdapterGets the value as a double.- Specified by:
getDoublein interfaceDataTypeAdapter- Parameters:
buf- the buffer from which to get the value- Returns:
- the value, as a double
-