Class Base64


  • public class Base64
    extends java.lang.Object
    Utility class that implements base64 encoding and decoding.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private static byte[] BASE64INDEXES  
      private static byte[] CHAR_SET  
    • Constructor Summary

      Constructors 
      Constructor Description
      Base64()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static byte[] decode​(byte[] buffer)
      Decodes Base64 data into octects.
      static java.lang.String decodeAsString​(byte[] buffer)
      Decodes array of bytes using base64 decoding and returns the result as a string.
      static java.lang.String decodeAsString​(java.lang.String text)
      Decodes a string using base64 and returns the result as another string.
      static byte[] encode​(byte[] buffer)
      Encodes array of bytes using base64 encoding.
      static java.lang.String encodeAsString​(byte[] buffer)
      Encodes array of bytes using base64 encoding and returns the result as a string.
      static java.lang.String encodeAsString​(java.lang.String text)
      Encodes a string using base64 and returns the result as another string.
      • Methods inherited from class java.lang.Object

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

      • CHAR_SET

        private static final byte[] CHAR_SET
      • BASE64INDEXES

        private static final byte[] BASE64INDEXES
    • Constructor Detail

      • Base64

        public Base64()
    • Method Detail

      • encode

        public static byte[] encode​(byte[] buffer)
        Encodes array of bytes using base64 encoding.
        Parameters:
        buffer - Array of bytes to be encoded.
        Returns:
        Encoded result as an array of bytes.
      • decode

        public static byte[] decode​(byte[] buffer)
        Decodes Base64 data into octects.
        Parameters:
        buffer - Byte array containing Base64 data
        Returns:
        Array containing decoded data.
      • encodeAsString

        public static java.lang.String encodeAsString​(byte[] buffer)
        Encodes array of bytes using base64 encoding and returns the result as a string.
        Parameters:
        buffer - Array of bytes to be encoded.
        Returns:
        Resulting encoded string.
      • encodeAsString

        public static java.lang.String encodeAsString​(java.lang.String text)
        Encodes a string using base64 and returns the result as another string.
        Parameters:
        text - String to be encoded.
        Returns:
        Resulting encoded string.
      • decodeAsString

        public static java.lang.String decodeAsString​(byte[] buffer)
        Decodes array of bytes using base64 decoding and returns the result as a string.
        Parameters:
        buffer - Array of bytes to be decoded.
        Returns:
        Resulting decoded string.
      • decodeAsString

        public static java.lang.String decodeAsString​(java.lang.String text)
        Decodes a string using base64 and returns the result as another string.
        Parameters:
        text - String to be decoded.
        Returns:
        Resulting decoded string.