Class Base64


  • public final class Base64
    extends java.lang.Object
    Class to encode to base 64.
    • Constructor Summary

      Constructors 
      Constructor Description
      Base64()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static byte[] decodeBase64Local​(byte[] base64Values)
      Convert a array of base64 encoded byte in a array of bytes, returning the bytes original values.
      static byte[] encodeBase64Local​(byte[] dataValues)
      Convert a array of bytes in a array of MIME Base64 values.
      static java.lang.String encodeBase64StringLocal​(byte[] dataValues)
      Convert a array of bytes in a array of MIME Base64 values.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Base64

        public Base64()
    • Method Detail

      • decodeBase64Local

        public static byte[] decodeBase64Local​(byte[] base64Values)
                                        throws java.lang.IllegalArgumentException
        Convert a array of base64 encoded byte in a array of bytes, returning the bytes original values. RFC 2045.

        Base64 only uses 6 bits, so fits each set of 4 base64 in 3 bytes Base64 | c1 | c2 | c3 | c4 | |7 6 5 4 3 2 1 0:7 6 5 4 3 2 1 0:7 6 5 4 3 2 1 0| Byte | b1 | b2 | b3 |

        Parameters:
        base64Values - is an array of base64 encoded values
        Returns:
        an array of bytes with the original values
        Throws:
        java.lang.IllegalArgumentException - if the provided base64 values are null, or do not fits the required length
      • encodeBase64Local

        public static byte[] encodeBase64Local​(byte[] dataValues)
                                        throws java.lang.IllegalArgumentException
        Convert a array of bytes in a array of MIME Base64 values. RFC 2045.
        Parameters:
        dataValues - is an array of bytes with the original values
        Returns:
        an array of base64 encoded values
        Throws:
        java.lang.IllegalArgumentException - if the provided base64 values are null, or do not fits the required length
      • encodeBase64StringLocal

        public static java.lang.String encodeBase64StringLocal​(byte[] dataValues)
                                                        throws java.lang.IllegalArgumentException
        Convert a array of bytes in a array of MIME Base64 values. RFC 2045.
        Parameters:
        dataValues - is an array of bytes with the original values
        Returns:
        a string with the base64 encoded values
        Throws:
        java.lang.IllegalArgumentException - if the provided base64 values are null, or do not fits the required length