public class BitFieldAdapter extends Object implements FieldAdapter
| Constructor and Description | 
|---|
BitFieldAdapter(boolean isSigned)
Creates a new bit field adapter with given signed-ness. 
 | 
| Modifier and Type | Method and Description | 
|---|---|
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. 
 | 
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. 
 | 
String | 
getString(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. 
 | 
void | 
setBigInteger(BigInteger value,
             int offset,
             int length,
             ByteBuffer buffer,
             boolean isRightJustified)
Sets the field value as a Java BigInteger. 
 | 
void | 
setByte(byte value,
       int offset,
       int length,
       ByteBuffer buffer,
       boolean isRightJustifed)
Sets the field value as a Java byte. 
 | 
void | 
setDouble(double value,
         int offset,
         int length,
         ByteBuffer buffer,
         boolean isRightJustifed)
Sets the field value as a Java double. 
 | 
void | 
setFloat(float value,
        int offset,
        int length,
        ByteBuffer buffer,
        boolean isRightJustifed)
Sets the field value as a Java float. 
 | 
void | 
setInt(int value,
      int offset,
      int length,
      ByteBuffer buffer,
      boolean isRightJustifed)
Sets the field value as a Java int. 
 | 
void | 
setLong(long value,
       int offset,
       int length,
       ByteBuffer buffer,
       boolean isRightJustifed)
Sets the field value as a Java long. 
 | 
void | 
setShort(short value,
        int offset,
        int length,
        ByteBuffer buffer,
        boolean isRightJustifed)
Sets the field value as a Java short. 
 | 
void | 
setString(String value,
         int offset,
         int length,
         ByteBuffer buf,
         boolean isRightJustifed)
Sets the field value as a Java string. 
 | 
void | 
setString(String value,
         int offset,
         int length,
         ByteBuffer buffer,
         boolean isRightJustifed,
         Charset charset)
Sets the field value as a Java string, using a specified
 character set to convert from characters to bytes. 
 | 
public BitFieldAdapter(boolean isSigned)
isSigned - true, if the bit field is signedpublic String getString(byte[] buf, int offset, int length, int startBit, int stopBit)
FieldAdaptergetString in interface 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 String getString(byte[] buf, int offset, int length, int startBit, int stopBit, Charset charset)
FieldAdaptergetString in interface 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 byte getByte(byte[] buf,
                    int offset,
                    int length,
                    int startBit,
                    int stopBit)
FieldAdaptergetByte in interface 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)
FieldAdaptergetShort in interface 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)
FieldAdaptergetInt in interface 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)
FieldAdaptergetLong in interface 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 float getFloat(byte[] buf,
                      int offset,
                      int length,
                      int startBit,
                      int stopBit)
FieldAdaptergetFloat in interface 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)
FieldAdaptergetDouble in interface 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 void setString(String value, int offset, int length, ByteBuffer buf, boolean isRightJustifed)
FieldAdaptersetString in interface FieldAdaptervalue - the field valueoffset - the field offsetlength - the length of the valuebuf - the byte buffer into which to set the valueisRightJustifed - true, if the string value should be right-justifiedpublic void setString(String value, int offset, int length, ByteBuffer buffer, boolean isRightJustifed, Charset charset)
FieldAdaptersetString in interface FieldAdaptervalue - the field valueoffset - the field offsetlength - the length of the valuebuffer - the byte buffer into which to set the valueisRightJustifed - 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,
                   ByteBuffer buffer,
                   boolean isRightJustifed)
FieldAdaptersetInt in interface FieldAdaptervalue - the field valueoffset - the field offsetlength - the length of the valuebuffer - the byte buffer into which to set the valueisRightJustifed - true, if the string value should be right-justifiedpublic void setDouble(double value,
                      int offset,
                      int length,
                      ByteBuffer buffer,
                      boolean isRightJustifed)
FieldAdaptersetDouble in interface FieldAdaptervalue - the field valueoffset - the field offsetlength - the length of the valuebuffer - the byte buffer into which to set the valueisRightJustifed - true, if the string value should be right-justifiedpublic void setFloat(float value,
                     int offset,
                     int length,
                     ByteBuffer buffer,
                     boolean isRightJustifed)
FieldAdaptersetFloat in interface FieldAdaptervalue - the field valueoffset - the field offsetlength - the length of the valuebuffer - the byte buffer into which to set the valueisRightJustifed - true, if the string value should be right-justifiedpublic void setShort(short value,
                     int offset,
                     int length,
                     ByteBuffer buffer,
                     boolean isRightJustifed)
FieldAdaptersetShort in interface FieldAdaptervalue - the field valueoffset - the field offsetlength - the length of the valuebuffer - the byte buffer into which to set the valueisRightJustifed - true, if the string value should be right-justifiedpublic void setByte(byte value,
                    int offset,
                    int length,
                    ByteBuffer buffer,
                    boolean isRightJustifed)
FieldAdaptersetByte in interface FieldAdaptervalue - the field valueoffset - the field offsetlength - the length of the valuebuffer - the byte buffer into which to set the valueisRightJustifed - true, if the string value should be right-justifiedpublic void setLong(long value,
                    int offset,
                    int length,
                    ByteBuffer buffer,
                    boolean isRightJustifed)
FieldAdaptersetLong in interface FieldAdaptervalue - the field valueoffset - the field offsetlength - the length of the valuebuffer - the byte buffer into which to set the valueisRightJustifed - true, if the string value should be right-justifiedpublic BigInteger getBigInteger(byte[] buf, int offset, int length, int startBit, int stopBit)
FieldAdaptergetBigInteger in interface 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 void setBigInteger(BigInteger value, int offset, int length, ByteBuffer buffer, boolean isRightJustified)
FieldAdaptersetBigInteger in interface 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-justifiedCopyright © 2025 Central Laboratory of the Research Councils. All Rights Reserved.