Class Base64


  • public class Base64
    extends java.lang.Object
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static int BASE64DEFAULTLENGTH
      Field BASE64DEFAULTLENGTH
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static byte[] decode​(java.lang.String encoded)
      Decodes Base64 data into octects
      static java.lang.String encode​(byte[] binaryData)
      Encode a byte array and fold lines at the standard 76th character.
      static java.lang.String encode​(byte[] binaryData, int length, boolean wrap)
      Encode a byte array in Base64 format and return an optionally wrapped line.
      protected static boolean isPad​(byte octect)  
      protected static boolean isWhiteSpace​(byte octect)  
      static void main​(java.lang.String[] args)  
      protected static int removeWhiteSpace​(byte[] data)
      remove WhiteSpace from MIME containing encoded Base64 data.
      • Methods inherited from class java.lang.Object

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

      • BASE64DEFAULTLENGTH

        public static final int BASE64DEFAULTLENGTH
        Field BASE64DEFAULTLENGTH
        See Also:
        Constant Field Values
    • Method Detail

      • encode

        public static java.lang.String encode​(byte[] binaryData)
        Encode a byte array and fold lines at the standard 76th character.
        Parameters:
        binaryData - byte[] to be base64 encoded
        Returns:
        the String with encoded data
      • isWhiteSpace

        protected static boolean isWhiteSpace​(byte octect)
      • isPad

        protected static boolean isPad​(byte octect)
      • encode

        public static java.lang.String encode​(byte[] binaryData,
                                              int length,
                                              boolean wrap)
        Encode a byte array in Base64 format and return an optionally wrapped line.
        Parameters:
        binaryData - byte[] data to be encoded
        length - int length of wrapped lines; No wrapping if less than 4.
        Returns:
        a String with encoded data
      • decode

        public static byte[] decode​(java.lang.String encoded)
                             throws WSSecurityException
        Decodes Base64 data into octects
        Parameters:
        encoded - String containing Base64 data
        Returns:
        Array containing decoded data.
        Throws:
        WSSecurityException
      • removeWhiteSpace

        protected static int removeWhiteSpace​(byte[] data)
        remove WhiteSpace from MIME containing encoded Base64 data.
        Parameters:
        data - the byte array of base64 data (with WS)
        Returns:
        the new length
      • main

        public static void main​(java.lang.String[] args)
        Parameters:
        args -