Package gov.nasa.pds.objectAccess.table
Class FloatBinaryFieldAdapter
- java.lang.Object
-
- gov.nasa.pds.objectAccess.table.FloatBinaryFieldAdapter
-
- All Implemented Interfaces:
FieldAdapter
public class FloatBinaryFieldAdapter extends java.lang.Object implements FieldAdapter
Implements a field adapter for binary, single-precision, floating-point fields.
-
-
Constructor Summary
Constructors Constructor Description FloatBinaryFieldAdapter(boolean isBigEndian)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.math.BigInteger
getBigInteger(byte[] buf, int offset, int length, int startBit, int stopBit)
Gets the field value as a Java BigInteger.byte
getByte(byte[] buf, int offset, int length, int startBit, int stopBit)
Gets the field value as a Java byte.double
getDouble(byte[] buf, int offset, int length, int startBit, int stopBit)
Gets the field value as a Java double.float
getFloat(byte[] buf, int offset, int length, int startBit, int stopBit)
Gets the field value as a Java float.int
getInt(byte[] buf, int offset, int length, int startBit, int stopBit)
Gets the field value as a Java int.long
getLong(byte[] buf, int offset, int length, int startBit, int stopBit)
Gets the field value as a Java long.short
getShort(byte[] buf, int offset, int length, int startBit, int stopBit)
Gets the field value as a Java short.java.lang.String
getString(byte[] buf, int offset, int length, int startBit, int stopBit)
Gets the field value as a Java string, using the US-ASCII character set to convert from bytes to characters.java.lang.String
getString(byte[] buf, int offset, int length, int startBit, int stopBit, java.nio.charset.Charset charset)
Gets the field value as a Java string, using a specified character set to convert from bytes to characters.void
setBigInteger(java.math.BigInteger value, int offset, int length, java.nio.ByteBuffer buffer, boolean isRightJustified)
Sets the field value as a Java BigInteger.void
setByte(byte value, int offset, int length, java.nio.ByteBuffer buffer, boolean isRightJustified)
Sets the field value as a Java byte.void
setDouble(double value, int offset, int length, java.nio.ByteBuffer buffer, boolean isRightJustified)
Sets the field value as a Java double.void
setFloat(float value, int offset, int length, java.nio.ByteBuffer buffer, boolean isRightJustified)
Sets the field value as a Java float.void
setInt(int value, int offset, int length, java.nio.ByteBuffer buffer, boolean isRightJustified)
Sets the field value as a Java int.void
setLong(long value, int offset, int length, java.nio.ByteBuffer buffer, boolean isRightJustified)
Sets the field value as a Java long.void
setShort(short value, int offset, int length, java.nio.ByteBuffer buffer, boolean isRightJustified)
Sets the field value as a Java short.void
setString(java.lang.String value, int offset, int length, java.nio.ByteBuffer buffer, boolean isRightJustified)
Sets the field value as a Java string.void
setString(java.lang.String value, int offset, int length, java.nio.ByteBuffer buffer, boolean isRightJustified, java.nio.charset.Charset charset)
Sets the field value as a Java string, using a specified character set to convert from characters to bytes.
-
-
-
Method Detail
-
getString
public java.lang.String getString(byte[] buf, int offset, int length, int startBit, int stopBit)
Description copied from interface:FieldAdapter
Gets the field value as a Java string, using the US-ASCII character set to convert from bytes to characters.- Specified by:
getString
in interfaceFieldAdapter
- Parameters:
buf
- the byte array containing the fieldoffset
- the field offsetlength
- the length of the field datastartBit
- the start bit, for bit fieldsstopBit
- the stop bit, for bit fields- Returns:
- the field value, as a string
-
getString
public java.lang.String getString(byte[] buf, int offset, int length, int startBit, int stopBit, java.nio.charset.Charset charset)
Description copied from interface:FieldAdapter
Gets the field value as a Java string, using a specified character set to convert from bytes to characters.- Specified by:
getString
in interfaceFieldAdapter
- Parameters:
buf
- the byte array containing the fieldoffset
- the field offsetlength
- the length of the field datastartBit
- the start bit, for bit fieldsstopBit
- the stop bit, for bit fieldscharset
- the character set to use when converting bytes to characters- Returns:
- the field value, as a string
-
getByte
public byte getByte(byte[] buf, int offset, int length, int startBit, int stopBit)
Description copied from interface:FieldAdapter
Gets the field value as a Java byte.- Specified by:
getByte
in interfaceFieldAdapter
- Parameters:
buf
- the byte array containing the fieldoffset
- the field offsetlength
- the length of the field datastartBit
- the start bit, for bit fieldsstopBit
- the stop bit, for bit fields- Returns:
- the field value, as a short
-
getShort
public short getShort(byte[] buf, int offset, int length, int startBit, int stopBit)
Description copied from interface:FieldAdapter
Gets the field value as a Java short.- Specified by:
getShort
in interfaceFieldAdapter
- Parameters:
buf
- the byte array containing the fieldoffset
- the field offsetlength
- the length of the field datastartBit
- the start bit, for bit fieldsstopBit
- the stop bit, for bit fields- Returns:
- the field value, as a short
-
getInt
public int getInt(byte[] buf, int offset, int length, int startBit, int stopBit)
Description copied from interface:FieldAdapter
Gets the field value as a Java int.- Specified by:
getInt
in interfaceFieldAdapter
- Parameters:
buf
- the byte array containing the fieldoffset
- the field offsetlength
- the length of the field datastartBit
- the start bit, for bit fieldsstopBit
- the stop bit, for bit fields- Returns:
- the field value, as an int
-
getLong
public long getLong(byte[] buf, int offset, int length, int startBit, int stopBit)
Description copied from interface:FieldAdapter
Gets the field value as a Java long.- Specified by:
getLong
in interfaceFieldAdapter
- Parameters:
buf
- the byte array containing the fieldoffset
- the field offsetlength
- the length of the field datastartBit
- the start bit, for bit fieldsstopBit
- the stop bit, for bit fields- Returns:
- the field value, as a long
-
getFloat
public float getFloat(byte[] buf, int offset, int length, int startBit, int stopBit)
Description copied from interface:FieldAdapter
Gets the field value as a Java float.- Specified by:
getFloat
in interfaceFieldAdapter
- Parameters:
buf
- the byte array containing the fieldoffset
- the field offsetlength
- the length of the field datastartBit
- the start bit, for bit fieldsstopBit
- the stop bit, for bit fields- Returns:
- the field value, as a float
-
getDouble
public double getDouble(byte[] buf, int offset, int length, int startBit, int stopBit)
Description copied from interface:FieldAdapter
Gets the field value as a Java double.- Specified by:
getDouble
in interfaceFieldAdapter
- Parameters:
buf
- the byte array containing the fieldoffset
- the field offsetlength
- the length of the field datastartBit
- the start bit, for bit fieldsstopBit
- the stop bit, for bit fields- Returns:
- the field value, as a double
-
setString
public void setString(java.lang.String value, int offset, int length, java.nio.ByteBuffer buffer, boolean isRightJustified)
Description copied from interface:FieldAdapter
Sets the field value as a Java string.- Specified by:
setString
in interfaceFieldAdapter
- Parameters:
value
- the field valueoffset
- the field offsetlength
- the length of the valuebuffer
- the byte buffer into which to set the valueisRightJustified
- true, if the string value should be right-justified
-
setString
public void setString(java.lang.String value, int offset, int length, java.nio.ByteBuffer buffer, boolean isRightJustified, java.nio.charset.Charset charset)
Description copied from interface:FieldAdapter
Sets the field value as a Java string, using a specified character set to convert from characters to bytes.- Specified by:
setString
in interfaceFieldAdapter
- Parameters:
value
- the field valueoffset
- the field offsetlength
- the length of the valuebuffer
- the byte buffer into which to set the valueisRightJustified
- true, if the string value should be right-justifiedcharset
- the character set to use when converting the string to bytes
-
setByte
public void setByte(byte value, int offset, int length, java.nio.ByteBuffer buffer, boolean isRightJustified)
Description copied from interface:FieldAdapter
Sets the field value as a Java byte.- Specified by:
setByte
in interfaceFieldAdapter
- Parameters:
value
- the field valueoffset
- the field offsetlength
- the length of the valuebuffer
- the byte buffer into which to set the valueisRightJustified
- true, if the string value should be right-justified
-
setShort
public void setShort(short value, int offset, int length, java.nio.ByteBuffer buffer, boolean isRightJustified)
Description copied from interface:FieldAdapter
Sets the field value as a Java short.- Specified by:
setShort
in interfaceFieldAdapter
- Parameters:
value
- the field valueoffset
- the field offsetlength
- the length of the valuebuffer
- the byte buffer into which to set the valueisRightJustified
- true, if the string value should be right-justified
-
setInt
public void setInt(int value, int offset, int length, java.nio.ByteBuffer buffer, boolean isRightJustified)
Description copied from interface:FieldAdapter
Sets the field value as a Java int.- Specified by:
setInt
in interfaceFieldAdapter
- Parameters:
value
- the field valueoffset
- the field offsetlength
- the length of the valuebuffer
- the byte buffer into which to set the valueisRightJustified
- true, if the string value should be right-justified
-
setLong
public void setLong(long value, int offset, int length, java.nio.ByteBuffer buffer, boolean isRightJustified)
Description copied from interface:FieldAdapter
Sets the field value as a Java long.- Specified by:
setLong
in interfaceFieldAdapter
- Parameters:
value
- the field valueoffset
- the field offsetlength
- the length of the valuebuffer
- the byte buffer into which to set the valueisRightJustified
- true, if the string value should be right-justified
-
setFloat
public void setFloat(float value, int offset, int length, java.nio.ByteBuffer buffer, boolean isRightJustified)
Description copied from interface:FieldAdapter
Sets the field value as a Java float.- Specified by:
setFloat
in interfaceFieldAdapter
- Parameters:
value
- the field valueoffset
- the field offsetlength
- the length of the valuebuffer
- the byte buffer into which to set the valueisRightJustified
- true, if the string value should be right-justified
-
setDouble
public void setDouble(double value, int offset, int length, java.nio.ByteBuffer buffer, boolean isRightJustified)
Description copied from interface:FieldAdapter
Sets the field value as a Java double.- Specified by:
setDouble
in interfaceFieldAdapter
- Parameters:
value
- the field valueoffset
- the field offsetlength
- the length of the valuebuffer
- the byte buffer into which to set the valueisRightJustified
- true, if the string value should be right-justified
-
getBigInteger
public java.math.BigInteger getBigInteger(byte[] buf, int offset, int length, int startBit, int stopBit)
Description copied from interface:FieldAdapter
Gets the field value as a Java BigInteger.- Specified by:
getBigInteger
in interfaceFieldAdapter
- Parameters:
buf
- the byte array containing the fieldoffset
- the field offsetlength
- the length of the field datastartBit
- the start bit, for bit fieldsstopBit
- the stop bit, for bit fields- Returns:
- the field value, as a
BigInteger
-
setBigInteger
public void setBigInteger(java.math.BigInteger value, int offset, int length, java.nio.ByteBuffer buffer, boolean isRightJustified)
Description copied from interface:FieldAdapter
Sets the field value as a Java BigInteger.- Specified by:
setBigInteger
in interfaceFieldAdapter
- Parameters:
value
- the field valueoffset
- the field offsetlength
- the length of the valuebuffer
- the byte buffer into which to set the valueisRightJustified
- true, if the string value should be right-justified
-
-