Package gov.nasa.pds.objectAccess.table
Class DoubleBinaryFieldAdapter
java.lang.Object
gov.nasa.pds.objectAccess.table.DoubleBinaryFieldAdapter
- All Implemented Interfaces:
FieldAdapter
public class DoubleBinaryFieldAdapter extends Object implements FieldAdapter
Implements a field adapter for binary, double-precision, floating-point fields.
-
Constructor Summary
Constructors Constructor Description DoubleBinaryFieldAdapter(boolean isBigEndian) -
Method Summary
Modifier and Type Method Description BigIntegergetBigInteger(byte[] buf, int offset, int length, int startBit, int stopBit)Gets the field value as a Java BigInteger.bytegetByte(byte[] buf, int offset, int length, int startBit, int stopBit)Gets the field value as a Java byte.doublegetDouble(byte[] buf, int offset, int length, int startBit, int stopBit)Gets the field value as a Java double.floatgetFloat(byte[] buf, int offset, int length, int startBit, int stopBit)Gets the field value as a Java float.intgetInt(byte[] buf, int offset, int length, int startBit, int stopBit)Gets the field value as a Java int.longgetLong(byte[] buf, int offset, int length, int startBit, int stopBit)Gets the field value as a Java long.shortgetShort(byte[] buf, int offset, int length, int startBit, int stopBit)Gets the field value as a Java short.StringgetString(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.StringgetString(byte[] buf, int offset, int length, int startBit, int stopBit, Charset charset)Gets the field value as a Java string, using a specified character set to convert from bytes to characters.voidsetBigInteger(BigInteger value, int offset, int length, ByteBuffer buffer, boolean isRightJustified)Sets the field value as a Java BigInteger.voidsetByte(byte value, int offset, int length, ByteBuffer buffer, boolean isRightJustified)Sets the field value as a Java byte.voidsetDouble(double value, int offset, int length, ByteBuffer buffer, boolean isRightJustified)Sets the field value as a Java double.voidsetFloat(float value, int offset, int length, ByteBuffer buffer, boolean isRightJustified)Sets the field value as a Java float.voidsetInt(int value, int offset, int length, ByteBuffer buffer, boolean isRightJustified)Sets the field value as a Java int.voidsetLong(long value, int offset, int length, ByteBuffer buffer, boolean isRightJustified)Sets the field value as a Java long.voidsetShort(short value, int offset, int length, ByteBuffer buffer, boolean isRightJustified)Sets the field value as a Java short.voidsetString(String value, int offset, int length, ByteBuffer buffer, boolean isRightJustified)Sets the field value as a Java string.voidsetString(String value, int offset, int length, ByteBuffer buffer, boolean isRightJustified, Charset charset)Sets the field value as a Java string, using a specified character set to convert from characters to bytes.
-
Constructor Details
-
DoubleBinaryFieldAdapter
public DoubleBinaryFieldAdapter(boolean isBigEndian)
-
-
Method Details
-
getString
Description copied from interface:FieldAdapterGets the field value as a Java string, using the US-ASCII character set to convert from bytes to characters.- Specified by:
getStringin 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 String getString(byte[] buf, int offset, int length, int startBit, int stopBit, Charset charset)Description copied from interface:FieldAdapterGets the field value as a Java string, using a specified character set to convert from bytes to characters.- Specified by:
getStringin 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:FieldAdapterGets the field value as a Java byte.- Specified by:
getBytein 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:FieldAdapterGets the field value as a Java short.- Specified by:
getShortin 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:FieldAdapterGets the field value as a Java int.- Specified by:
getIntin 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:FieldAdapterGets the field value as a Java long.- Specified by:
getLongin 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:FieldAdapterGets the field value as a Java float.- Specified by:
getFloatin 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:FieldAdapterGets the field value as a Java double.- Specified by:
getDoublein 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(String value, int offset, int length, ByteBuffer buffer, boolean isRightJustified)Description copied from interface:FieldAdapterSets the field value as a Java string.- Specified by:
setStringin 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(String value, int offset, int length, ByteBuffer buffer, boolean isRightJustified, Charset charset)Description copied from interface:FieldAdapterSets the field value as a Java string, using a specified character set to convert from characters to bytes.- Specified by:
setStringin 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, ByteBuffer buffer, boolean isRightJustified)Description copied from interface:FieldAdapterSets the field value as a Java byte.- Specified by:
setBytein 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, ByteBuffer buffer, boolean isRightJustified)Description copied from interface:FieldAdapterSets the field value as a Java short.- Specified by:
setShortin 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
Description copied from interface:FieldAdapterSets the field value as a Java int.- Specified by:
setIntin 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, ByteBuffer buffer, boolean isRightJustified)Description copied from interface:FieldAdapterSets the field value as a Java long.- Specified by:
setLongin 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, ByteBuffer buffer, boolean isRightJustified)Description copied from interface:FieldAdapterSets the field value as a Java float.- Specified by:
setFloatin 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, ByteBuffer buffer, boolean isRightJustified)Description copied from interface:FieldAdapterSets the field value as a Java double.- Specified by:
setDoublein 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
Description copied from interface:FieldAdapterGets the field value as a Java BigInteger.- Specified by:
getBigIntegerin 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(BigInteger value, int offset, int length, ByteBuffer buffer, boolean isRightJustified)Description copied from interface:FieldAdapterSets the field value as a Java BigInteger.- Specified by:
setBigIntegerin 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
-