Class Base64


  • @Deprecated
    public class Base64
    extends Object
    Deprecated.
    Implementation of MIME's Base64 encoding and decoding conversions. Optimized code. (raw version taken from oreilly.jonathan.util, and currently org.apache.xerces.ds.util.Base64)
    See Also:
    RFC 2045, TransformBase64Decode
    • Field Detail

      • BASE64DEFAULTLENGTH

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

      • encode

        public static final String encode​(BigInteger big)
        Deprecated.
        Encode in Base64 the given BigInteger.
        Parameters:
        big -
        Returns:
        String with Base64 encoding
      • encode

        public static final byte[] encode​(BigInteger big,
                                          int bitlen)
        Deprecated.
        Returns a byte-array representation of a BigInteger. No sign-bit is output. N.B.: BigInteger's toByteArray returns eventually longer arrays because of the leading sign-bit.
        Parameters:
        big - BigInteger to be converted
        bitlen - int the desired length in bits of the representation
        Returns:
        a byte array with bitlen bits of big
      • fillElementWithBigInteger

        public static final void fillElementWithBigInteger​(Element element,
                                                           BigInteger biginteger)
        Deprecated.
        This method takes an (empty) Element and a BigInteger and adds the base64 encoded BigInteger to the Element.
        Parameters:
        element -
        biginteger -
      • decode

        public static final byte[] decode​(Element element)
                                   throws Base64DecodingException
        Deprecated.
        Method decode Takes the Text children of the Element and interprets them as input for the Base64.decode() function.
        Parameters:
        element -
        Returns:
        the byte obtained of the decoding the element $todo$ not tested yet
        Throws:
        Base64DecodingException
      • encodeToElement

        public static final Element encodeToElement​(Document doc,
                                                    String localName,
                                                    byte[] bytes)
        Deprecated.
        Method encodeToElement
        Parameters:
        doc -
        localName -
        bytes -
        Returns:
        an Element with the base64 encoded in the text.
      • encode

        public static final String encode​(byte[] binaryData)
        Deprecated.
        Encode a byte array and fold lines at the standard 76th character unless ignore line breaks property is set.
        Parameters:
        binaryData - byte[] to be base64 encoded
        Returns:
        the String with encoded data
      • isWhiteSpace

        protected static final boolean isWhiteSpace​(byte octet)
        Deprecated.
      • isPad

        protected static final boolean isPad​(byte octet)
        Deprecated.
      • encode

        public static final String encode​(byte[] binaryData,
                                          int length)
        Deprecated.
        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 final byte[] decode​(String encoded)
                                   throws Base64DecodingException
        Deprecated.
        Decodes Base64 data into octets
        Parameters:
        encoded - String containing base64 encoded data
        Returns:
        byte array containing the decoded data
        Throws:
        Base64DecodingException - if there is a problem decoding the data
      • getBytesInternal

        protected static final int getBytesInternal​(String s,
                                                    byte[] result)
        Deprecated.
      • removeWhiteSpace

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