Class Base64


  • @Deprecated
    public class Base64
    extends java.lang.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
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private Base64()
      Deprecated.
       
    • Method Summary

      All Methods Static Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method Description
      static byte[] decode​(byte[] base64)
      Deprecated.
      Method decode
      static void decode​(byte[] base64Data, java.io.OutputStream os)
      Deprecated.
      Decodes Base64 data into outputstream
      protected static void decode​(byte[] base64Data, java.io.OutputStream os, int len)
      Deprecated.
       
      static byte[] decode​(java.io.BufferedReader reader)
      Deprecated.
      Base64 decode the lines from the reader and return an InputStream with the bytes.
      static void decode​(java.io.InputStream is, java.io.OutputStream os)
      Deprecated.
      Decodes Base64 data into outputstream
      static byte[] decode​(java.lang.String encoded)
      Deprecated.
      Decodes Base64 data into octets
      static void decode​(java.lang.String base64Data, java.io.OutputStream os)
      Deprecated.
      Decodes Base64 data into outputstream
      static byte[] decode​(org.w3c.dom.Element element)
      Deprecated.
      Method decode Takes the Text children of the Element and interprets them as input for the Base64.decode() function.
      static java.math.BigInteger decodeBigIntegerFromElement​(org.w3c.dom.Element element)
      Deprecated.
      Method decodeBigIntegerFromElement
      static java.math.BigInteger decodeBigIntegerFromText​(org.w3c.dom.Text text)
      Deprecated.
      Decode a base 64 string into a BigInteger
      protected static byte[] decodeInternal​(byte[] base64Data, int len)
      Deprecated.
       
      static java.lang.String encode​(byte[] binaryData)
      Deprecated.
      Encode a byte array and fold lines at the standard 76th character unless ignore line breaks property is set.
      static java.lang.String encode​(byte[] binaryData, int length)
      Deprecated.
      Encode a byte array in Base64 format and return an optionally wrapped line.
      static java.lang.String encode​(java.math.BigInteger big)
      Deprecated.
      Encode in Base64 the given BigInteger.
      static byte[] encode​(java.math.BigInteger big, int bitlen)
      Deprecated.
      Returns a byte-array representation of a BigInteger.
      static org.w3c.dom.Element encodeToElement​(org.w3c.dom.Document doc, java.lang.String localName, byte[] bytes)
      Deprecated.
      Method encodeToElement
      static void fillElementWithBigInteger​(org.w3c.dom.Element element, java.math.BigInteger biginteger)
      Deprecated.
      This method takes an (empty) Element and a BigInteger and adds the base64 encoded BigInteger to the Element.
      (package private) static byte[] getBytes​(java.math.BigInteger big, int bitlen)
      Deprecated.
      Returns a byte-array representation of a BigInteger.
      protected static int getBytesInternal​(java.lang.String s, byte[] result)
      Deprecated.
       
      protected static boolean isPad​(byte octet)
      Deprecated.
       
      protected static boolean isWhiteSpace​(byte octet)
      Deprecated.
       
      protected static int removeWhiteSpace​(byte[] data)
      Deprecated.
      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
        Deprecated.
        Field BASE64DEFAULTLENGTH
        See Also:
        Constant Field Values
      • TWENTYFOURBITGROUP

        private static final int TWENTYFOURBITGROUP
        Deprecated.
        See Also:
        Constant Field Values
      • base64Alphabet

        private static final byte[] base64Alphabet
        Deprecated.
      • lookUpBase64Alphabet

        private static final char[] lookUpBase64Alphabet
        Deprecated.
    • Constructor Detail

      • Base64

        private Base64()
        Deprecated.
    • Method Detail

      • getBytes

        static final byte[] getBytes​(java.math.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
      • encode

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

        public static final byte[] encode​(java.math.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
      • decodeBigIntegerFromElement

        public static final java.math.BigInteger decodeBigIntegerFromElement​(org.w3c.dom.Element element)
                                                                      throws Base64DecodingException
        Deprecated.
        Method decodeBigIntegerFromElement
        Parameters:
        element -
        Returns:
        the biginteger obtained from the node
        Throws:
        Base64DecodingException
      • decodeBigIntegerFromText

        public static final java.math.BigInteger decodeBigIntegerFromText​(org.w3c.dom.Text text)
                                                                   throws Base64DecodingException
        Deprecated.
        Decode a base 64 string into a BigInteger
        Parameters:
        base64str - Base 64 encoded string.
        Returns:
        a decoded BigInteger
        Throws:
        Base64DecodingException
      • fillElementWithBigInteger

        public static final void fillElementWithBigInteger​(org.w3c.dom.Element element,
                                                           java.math.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​(org.w3c.dom.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 org.w3c.dom.Element encodeToElement​(org.w3c.dom.Document doc,
                                                                java.lang.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 java.lang.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
      • decode

        public static final byte[] decode​(java.io.BufferedReader reader)
                                   throws java.io.IOException,
                                          Base64DecodingException
        Deprecated.
        Base64 decode the lines from the reader and return an InputStream with the bytes.
        Parameters:
        reader -
        Returns:
        InputStream with the decoded bytes
        Throws:
        java.io.IOException - passes what the reader throws
        java.io.IOException
        Base64DecodingException
      • isWhiteSpace

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

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

        public static final java.lang.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​(java.lang.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​(java.lang.String s,
                                                    byte[] result)
        Deprecated.
      • decode

        public static final void decode​(java.lang.String base64Data,
                                        java.io.OutputStream os)
                                 throws Base64DecodingException,
                                        java.io.IOException
        Deprecated.
        Decodes Base64 data into outputstream
        Parameters:
        base64Data - String containing Base64 data
        os - the outputstream
        Throws:
        java.io.IOException
        Base64DecodingException
      • decode

        public static final void decode​(byte[] base64Data,
                                        java.io.OutputStream os)
                                 throws Base64DecodingException,
                                        java.io.IOException
        Deprecated.
        Decodes Base64 data into outputstream
        Parameters:
        base64Data - Byte array containing Base64 data
        os - the outputstream
        Throws:
        java.io.IOException
        Base64DecodingException
      • decode

        public static final void decode​(java.io.InputStream is,
                                        java.io.OutputStream os)
                                 throws Base64DecodingException,
                                        java.io.IOException
        Deprecated.
        Decodes Base64 data into outputstream
        Parameters:
        is - containing Base64 data
        os - the outputstream
        Throws:
        java.io.IOException
        Base64DecodingException
      • 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