public class SafeFieldAdapter
extends java.lang.Object
implements gov.nasa.pds.objectAccess.table.FieldAdapter
Currently only the get* methods are so wrapped,
since the set* methods are (a) less likely to encounter
problems from data and (b) not used by this package.
| Constructor and Description |
|---|
SafeFieldAdapter(gov.nasa.pds.objectAccess.table.FieldAdapter base)
Constructor.
|
| Modifier and Type | Method and 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 buf,
boolean isRightJustified)
Sets the field value as a Java BigInteger.
|
void |
setByte(byte value,
int offset,
int length,
java.nio.ByteBuffer buf,
boolean isRightJustified)
Sets the field value as a Java byte.
|
void |
setDouble(double value,
int offset,
int length,
java.nio.ByteBuffer buf,
boolean isRightJustified)
Sets the field value as a Java double.
|
void |
setFloat(float value,
int offset,
int length,
java.nio.ByteBuffer buf,
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 buf,
boolean isRightJustified)
Sets the field value as a Java long.
|
void |
setShort(short value,
int offset,
int length,
java.nio.ByteBuffer buf,
boolean isRightJustified)
Sets the field value as a Java short.
|
void |
setString(java.lang.String value,
int offset,
int length,
java.nio.ByteBuffer buf,
boolean isRightJustified)
Sets the field value as a Java string.
|
void |
setString(java.lang.String value,
int offset,
int length,
java.nio.ByteBuffer buf,
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.
|
public SafeFieldAdapter(gov.nasa.pds.objectAccess.table.FieldAdapter base)
base - instance on which this object's behaviour is basedpublic byte getByte(byte[] buf,
int offset,
int length,
int startBit,
int stopBit)
gov.nasa.pds.objectAccess.table.FieldAdaptergetByte in interface gov.nasa.pds.objectAccess.table.FieldAdapterbuf - 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 fieldspublic short getShort(byte[] buf,
int offset,
int length,
int startBit,
int stopBit)
gov.nasa.pds.objectAccess.table.FieldAdaptergetShort in interface gov.nasa.pds.objectAccess.table.FieldAdapterbuf - 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 fieldspublic int getInt(byte[] buf,
int offset,
int length,
int startBit,
int stopBit)
gov.nasa.pds.objectAccess.table.FieldAdaptergetInt in interface gov.nasa.pds.objectAccess.table.FieldAdapterbuf - 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 fieldspublic long getLong(byte[] buf,
int offset,
int length,
int startBit,
int stopBit)
gov.nasa.pds.objectAccess.table.FieldAdaptergetLong in interface gov.nasa.pds.objectAccess.table.FieldAdapterbuf - 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 fieldspublic java.math.BigInteger getBigInteger(byte[] buf,
int offset,
int length,
int startBit,
int stopBit)
gov.nasa.pds.objectAccess.table.FieldAdaptergetBigInteger in interface gov.nasa.pds.objectAccess.table.FieldAdapterbuf - 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 fieldsBigIntegerpublic float getFloat(byte[] buf,
int offset,
int length,
int startBit,
int stopBit)
gov.nasa.pds.objectAccess.table.FieldAdaptergetFloat in interface gov.nasa.pds.objectAccess.table.FieldAdapterbuf - 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 fieldspublic double getDouble(byte[] buf,
int offset,
int length,
int startBit,
int stopBit)
gov.nasa.pds.objectAccess.table.FieldAdaptergetDouble in interface gov.nasa.pds.objectAccess.table.FieldAdapterbuf - 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 fieldspublic java.lang.String getString(byte[] buf,
int offset,
int length,
int startBit,
int stopBit)
gov.nasa.pds.objectAccess.table.FieldAdaptergetString in interface gov.nasa.pds.objectAccess.table.FieldAdapterbuf - 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 fieldspublic java.lang.String getString(byte[] buf,
int offset,
int length,
int startBit,
int stopBit,
java.nio.charset.Charset charset)
gov.nasa.pds.objectAccess.table.FieldAdaptergetString in interface gov.nasa.pds.objectAccess.table.FieldAdapterbuf - 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 characterspublic void setString(java.lang.String value,
int offset,
int length,
java.nio.ByteBuffer buf,
boolean isRightJustified)
gov.nasa.pds.objectAccess.table.FieldAdaptersetString in interface gov.nasa.pds.objectAccess.table.FieldAdaptervalue - the field valueoffset - the field offsetlength - the length of the valuebuf - the byte buffer into which to set the valueisRightJustified - true, if the string value should be right-justifiedpublic void setString(java.lang.String value,
int offset,
int length,
java.nio.ByteBuffer buf,
boolean isRightJustified,
java.nio.charset.Charset charset)
gov.nasa.pds.objectAccess.table.FieldAdaptersetString in interface gov.nasa.pds.objectAccess.table.FieldAdaptervalue - the field valueoffset - the field offsetlength - the length of the valuebuf - 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 bytespublic void setInt(int value,
int offset,
int length,
java.nio.ByteBuffer buffer,
boolean isRightJustified)
gov.nasa.pds.objectAccess.table.FieldAdaptersetInt in interface gov.nasa.pds.objectAccess.table.FieldAdaptervalue - 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-justifiedpublic void setDouble(double value,
int offset,
int length,
java.nio.ByteBuffer buf,
boolean isRightJustified)
gov.nasa.pds.objectAccess.table.FieldAdaptersetDouble in interface gov.nasa.pds.objectAccess.table.FieldAdaptervalue - the field valueoffset - the field offsetlength - the length of the valuebuf - the byte buffer into which to set the valueisRightJustified - true, if the string value should be right-justifiedpublic void setFloat(float value,
int offset,
int length,
java.nio.ByteBuffer buf,
boolean isRightJustified)
gov.nasa.pds.objectAccess.table.FieldAdaptersetFloat in interface gov.nasa.pds.objectAccess.table.FieldAdaptervalue - the field valueoffset - the field offsetlength - the length of the valuebuf - the byte buffer into which to set the valueisRightJustified - true, if the string value should be right-justifiedpublic void setShort(short value,
int offset,
int length,
java.nio.ByteBuffer buf,
boolean isRightJustified)
gov.nasa.pds.objectAccess.table.FieldAdaptersetShort in interface gov.nasa.pds.objectAccess.table.FieldAdaptervalue - the field valueoffset - the field offsetlength - the length of the valuebuf - the byte buffer into which to set the valueisRightJustified - true, if the string value should be right-justifiedpublic void setByte(byte value,
int offset,
int length,
java.nio.ByteBuffer buf,
boolean isRightJustified)
gov.nasa.pds.objectAccess.table.FieldAdaptersetByte in interface gov.nasa.pds.objectAccess.table.FieldAdaptervalue - the field valueoffset - the field offsetlength - the length of the valuebuf - the byte buffer into which to set the valueisRightJustified - true, if the string value should be right-justifiedpublic void setLong(long value,
int offset,
int length,
java.nio.ByteBuffer buf,
boolean isRightJustified)
gov.nasa.pds.objectAccess.table.FieldAdaptersetLong in interface gov.nasa.pds.objectAccess.table.FieldAdaptervalue - the field valueoffset - the field offsetlength - the length of the valuebuf - the byte buffer into which to set the valueisRightJustified - true, if the string value should be right-justifiedpublic void setBigInteger(java.math.BigInteger value,
int offset,
int length,
java.nio.ByteBuffer buf,
boolean isRightJustified)
gov.nasa.pds.objectAccess.table.FieldAdaptersetBigInteger in interface gov.nasa.pds.objectAccess.table.FieldAdaptervalue - the field valueoffset - the field offsetlength - the length of the valuebuf - the byte buffer into which to set the valueisRightJustified - true, if the string value should be right-justified