Package es.gob.afirma.utils
Class Base64Coder
- java.lang.Object
-
- es.gob.afirma.utils.Base64Coder
-
public final class Base64Coder extends java.lang.ObjectUtility class for coding and decoding binary data on Base 64 format.
Project:Library for the integration with the services of @Firma, eVisor and TS@.
- Version:
- 1.0, 18/03/2011.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static byte[]decodeBase64(byte[] data)Method that decodes data encoded on Base64.static byte[]decodeBase64(byte[] data, int offset, int len)Method that decodes data encoded on Base64.static java.lang.StringdecodeBase64(java.lang.String data)Method that decodes a string encoded on Base64.static byte[]encodeBase64(byte[] data)Method that encodes data on Base64.static byte[]encodeBase64(byte[] data, int offset, int len)Method that encodes data on Base64.static java.lang.StringencodeBase64(java.lang.String data)Method that encodes a string on Base64.static booleanisBase64Encoded(byte[] data)Method that checks if data is encoded on Base64.
-
-
-
Method Detail
-
encodeBase64
public static byte[] encodeBase64(byte[] data) throws TransformersExceptionMethod that encodes data on Base64.- Parameters:
data- Parameter that represents the data to encode.- Returns:
- the data encoded on Base64.
- Throws:
TransformersException- If the method fails.
-
encodeBase64
public static byte[] encodeBase64(byte[] data, int offset, int len) throws TransformersExceptionMethod that encodes data on Base64.- Parameters:
data- Parameter that represents the data to encode.offset- Parameter that represents the initial position where to start the encoding.len- Parameter that represents the final position where to finish the encoding.- Returns:
- the data encoded on Base64.
- Throws:
TransformersException- If the method fails.
-
decodeBase64
public static byte[] decodeBase64(byte[] data) throws TransformersExceptionMethod that decodes data encoded on Base64.- Parameters:
data- Parameter that represents the data to decode.- Returns:
- the decoded data.
- Throws:
TransformersException- If the method fails.
-
decodeBase64
public static byte[] decodeBase64(byte[] data, int offset, int len) throws TransformersExceptionMethod that decodes data encoded on Base64.- Parameters:
data- Parameter that represents the data to decode.offset- Parameter that represents the initial position where to start the decoding.len- Parameter that represents the final position where to finish the encoding.- Returns:
- the decoded data.
- Throws:
TransformersException- If the method fails.
-
isBase64Encoded
public static boolean isBase64Encoded(byte[] data)
Method that checks if data is encoded on Base64.- Parameters:
data- Parameter that represents the data to check.- Returns:
- a boolean that defines if the data is encoded on Base64 (true) or not (false).
-
encodeBase64
public static java.lang.String encodeBase64(java.lang.String data) throws TransformersExceptionMethod that encodes a string on Base64.- Parameters:
data- Parameter that represents the string to encode.- Returns:
- the string encoded on Base64.
- Throws:
TransformersException- If the method fails.
-
decodeBase64
public static java.lang.String decodeBase64(java.lang.String data) throws TransformersExceptionMethod that decodes a string encoded on Base64.- Parameters:
data- Parameter that represents the string to decode.- Returns:
- the decoded string.
- Throws:
TransformersException- If the method fails.
-
-