Class BASE64Utility

java.lang.Object
com.tivoli.am.fim.base64.BASE64Utility

public final class BASE64Utility extends Object
  • Method Summary

    Modifier and Type
    Method
    Description
    static byte[]
    decode(byte[] in)
    This method extracts the bytes of the String into a byte array using the UTF-8 character encoding.
    static byte[]
    This method extracts the bytes of the String into a byte array using the UTF-8 character encoding.
    static String
    encode(byte[] in)
    Reads the input array and returns the base 64 encoding of the bytes that are in the byte array.
    static String
    encode(byte[] in, boolean crlf76)
    Reads the input array and returns the base 64 encoding of the bytes that are in the byte array.

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • decode

      public static byte[] decode(byte[] in) throws IOException
      This method extracts the bytes of the String into a byte array using the UTF-8 character encoding. The byte array is then decoded in accordance with the Base 64 RFC2045 and a byte array of the decoded bytes is returned.
      Parameters:
      in - The string to decode in accordance with the Base 64 RFC2045.
      Returns:
      The base 64 decoding of the bytes that are read off the stream.
      Throws:
      IOException - If an error occurs while reading off the stream.
    • decode

      public static byte[] decode(String in) throws IOException
      This method extracts the bytes of the String into a byte array using the UTF-8 character encoding. The byte array is then decoded in accordance with the Base 64 RFC2045 and a byte array of the decoded bytes is returned.
      Parameters:
      in - The string to decode in accordance with the Base 64 RFC2045.
      Returns:
      The base 64 decoding of the bytes that are read off the stream.
      Throws:
      IOException - If an error occurs while reading off the stream.
    • encode

      public static String encode(byte[] in, boolean crlf76) throws IOException
      Reads the input array and returns the base 64 encoding of the bytes that are in the byte array.
      Parameters:
      in - Array of bytes to be encoded.
      crlf76 - A value of true indicates that a carriage-return and line-feed (0x000D 0x000A) pair are written at 76 byte intervals as specified by the MIME Part one RFC2045. A value of false indicates that no carriage-return line-feed pair are in the base 64 encoding result.
      Returns:
      The base 64 encoding of the bytes that are read off the stream.
      Throws:
      IOException - If an error occurs while reading off the stream.
    • encode

      public static String encode(byte[] in) throws IOException
      Reads the input array and returns the base 64 encoding of the bytes that are in the byte array. By default, CRLF characters are inserted in the output at 76 byte intervals in accordnce with RFC2045.
      Parameters:
      in - Array of bytes to be encoded.
      Returns:
      The base 64 encoding of the bytes that are read off the stream.
      Throws:
      IOException - If an error occurs while reading off the stream.