gov.nasa.pds.objectAccess.array
Class IntegerAdapter

java.lang.Object
  extended by 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
IntegerAdapter(int elementSize, boolean isBigEndian, boolean isUnsigned)
          Creates a new adapter for an integer of given size.
 
Method Summary
 double getDouble(ByteBuffer buf)
          Gets the value as a double.
 int getInt(ByteBuffer buf)
          Gets the value as an int.
 long getLong(ByteBuffer buf)
          Gets the value as a long.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

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 integer
isBigEndian - true, if the data is big-endian, false if little-endian
isUnsigned - true, if the data is unsigned, false if signed
Method Detail

getInt

public int getInt(ByteBuffer buf)
Description copied from interface: DataTypeAdapter
Gets the value as an int.

Specified by:
getInt in interface DataTypeAdapter
Parameters:
buf - the buffer from which to get the value
Returns:
the value, as an int

getLong

public long getLong(ByteBuffer buf)
Description copied from interface: DataTypeAdapter
Gets the value as a long.

Specified by:
getLong in interface DataTypeAdapter
Parameters:
buf - the buffer from which to get the value
Returns:
the value, as a long

getDouble

public double getDouble(ByteBuffer buf)
Description copied from interface: DataTypeAdapter
Gets the value as a double.

Specified by:
getDouble in interface DataTypeAdapter
Parameters:
buf - the buffer from which to get the value
Returns:
the value, as a double


Copyright © 2013. All Rights Reserved.