Package org.openmuc.jdlms.datatypes
Class BitString
- java.lang.Object
-
- org.openmuc.jdlms.datatypes.BitString
-
public class BitString extends java.lang.Object
Arbitrary string of bits (zeros and ones). A bit string value can have any length including zero.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description byte[]
getBitString()
Get the bit string as byte array.int
getNumBits()
The number of bits in the byte array.
-
-
-
Constructor Detail
-
BitString
public BitString(byte[] bitString, int numBits)
Construct a new bit string object.- Parameters:
bitString
- as a a byte array.numBits
- the number of bits.- Throws:
java.lang.IllegalArgumentException
- if the passed number of is is out of range.
numBits <= (bitString.length - 1) * 8 + 1 || numBits > bitString.length * 8
-
BitString
public BitString(BitString other)
Copy Constructor.- Parameters:
other
- the other bit string,
-
-
Method Detail
-
getBitString
public byte[] getBitString()
Get the bit string as byte array.- Returns:
- the bit string.
-
getNumBits
public int getNumBits()
The number of bits in the byte array.- Returns:
- the number of bits.
- See Also:
getBitString()
-
-