Class UtilsBytesAndBits


  • public final class UtilsBytesAndBits
    extends java.lang.Object

    Class that provides methods to work and transforms bytes to bits and vice versa.

    Project:

    Library for the integration with the services of @Firma, eVisor and TS@.

    Version:
    1.0, 11/11/2020.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static byte[] bitToByteArray​(java.util.BitSet bits)
      Transforms the input bit set to a byte array.
      static java.util.BitSet byteArrayToBits​(byte[] byteArray)
      Transforms the input byte array to a bit set.
      static java.util.BitSet byteToBits​(byte b)
      Transforms the input byte to a bit set.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • bitToByteArray

        public static byte[] bitToByteArray​(java.util.BitSet bits)
        Transforms the input bit set to a byte array.
        Parameters:
        bits - Input bit set to transform.
        Returns:
        a byte array with all the input bits, or null if the input is null.
      • byteToBits

        public static java.util.BitSet byteToBits​(byte b)
        Transforms the input byte to a bit set.
        Parameters:
        b - Input byte to transform.
        Returns:
        a bit set extracted from the input byte.
      • byteArrayToBits

        public static java.util.BitSet byteArrayToBits​(byte[] byteArray)
        Transforms the input byte array to a bit set.
        Parameters:
        byteArray - Input byte array to transform.
        Returns:
        a bit set with all the input bytes, or null if the input is null.