Class Base64CoderCommons


  • public final class Base64CoderCommons
    extends java.lang.Object

    Utility 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.String decodeBase64​(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.String encodeBase64​(java.lang.String data)
      Method that encodes a string on Base64.
      static boolean isBase64Encoded​(byte[] data)
      Method that checks if data is encoded on Base64.
      • Methods inherited from class java.lang.Object

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

      • encodeBase64

        public static byte[] encodeBase64​(byte[] data)
                                   throws TransformersException
        Method 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 TransformersException
        Method 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 TransformersException
        Method 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 TransformersException
        Method 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 TransformersException
        Method 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 TransformersException
        Method 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.