com.kuka.roboticsAPI.ioModel
Class BitSetConverter

java.lang.Object
  extended by com.kuka.roboticsAPI.ioModel.BitSetConverter

public final class BitSetConverter
extends Object

Converter for java BitSet. Converts numbers and arrays into bitset and vice versa.

This element is an undocumented internal feature. It is not intended to be used by applications as it might change or be removed in future versions.

Method Summary
static void convertIntNumber(long number, int bitSize, BitSet bits)
          Converts an integer number of the specified size into a BitSet.
static BitSet fromByteArray(byte[] bytes)
          Returns a BitSet containing the values in bytes.
static byte[] toByteArray(BitSet bits)
          Returns a byte array of at least length 1.
static byte[] toByteArray(BitSet bits, int arraySize)
          Returns a byte array with the length of the specified array size.
static long toIntNumber(BitSet bits, boolean signed, int bitSize)
          Converts a BitSet to an integer number.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

fromByteArray

public static BitSet fromByteArray(byte[] bytes)
Returns a BitSet containing the values in bytes.

Parameters:
bytes - byte array containing the data to convert. The byte-ordering of bytes must be little-endian which means the least significant bit is in element 0.
Returns:
BitSet containing the values in bytes
This element is an undocumented internal feature. It is not intended to be used by applications as it might change or be removed in future versions.

toByteArray

public static byte[] toByteArray(BitSet bits)
Returns a byte array of at least length 1. The most significant bit in the result is guaranteed not to be a 1 (since BitSet does not support sign extension). The byte-ordering of the result is little-endian which means the least significant bit is in element 0. The bit at index 0 of the bit set is assumed to be the least significant bit.

Parameters:
bits - BitSet containing the data to converts
Returns:
byte array with the data of the BitSet of at least length 1
This element is an undocumented internal feature. It is not intended to be used by applications as it might change or be removed in future versions.

toByteArray

public static byte[] toByteArray(BitSet bits,
                                 int arraySize)
Returns a byte array with the length of the specified array size. The most significant bit in the result is guaranteed not to be a 1 (since BitSet does not support sign extension). The byte-ordering of the result is little-endian which means the least significant bit is in element 0. The bit at index 0 of the bit set is assumed to be the least significant bit.

Parameters:
bits - BitSet containing the data to converts
arraySize - size of the array to be returned
Returns:
byte array with the data of the BitSet of at least length 1
Throws:
IllegalStateException - if arraySize is not big enough for BitSet data
This element is an undocumented internal feature. It is not intended to be used by applications as it might change or be removed in future versions.

convertIntNumber

public static void convertIntNumber(long number,
                                    int bitSize,
                                    BitSet bits)
Converts an integer number of the specified size into a BitSet.

Parameters:
number - the number to convert
bitSize - the size of the number
bits - the result bitSet
This element is an undocumented internal feature. It is not intended to be used by applications as it might change or be removed in future versions.

toIntNumber

public static long toIntNumber(BitSet bits,
                               boolean signed,
                               int bitSize)
Converts a BitSet to an integer number.

Parameters:
bits - the BitSet to convert.
signed - true if resulting number should be signed, false if unsigned
bitSize - size in bits of the bitSet
Returns:
corresponding integer number
This element is an undocumented internal feature. It is not intended to be used by applications as it might change or be removed in future versions.


Copyright © 2019. All rights reserved.