Package es.gob.afirma.tsl.utils
Class UtilsBytesAndBits
- java.lang.Object
-
- es.gob.afirma.tsl.utils.UtilsBytesAndBits
-
public final class UtilsBytesAndBits extends java.lang.ObjectClass 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.BitSetbyteArrayToBits(byte[] byteArray)Transforms the input byte array to a bit set.static java.util.BitSetbyteToBits(byte b)Transforms the input byte to a bit set.
-
-
-
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
nullif the input isnull.
-
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
nullif the input isnull.
-
-