Package hec.util

Class Base64

java.lang.Object
hec.util.Base64

public class Base64 extends Object
Class for base64 encoding/decoding
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static byte[]
    decode(byte[] in)
    Base64 decodes an array of bytes
    static byte[]
    decode(byte[] in, int offset, int len)
    Base64 decodes an array of bytes
    static String
    Base64 decodes a string, which is interpreted according to the ISO-8859-1 character set
    static String
    decode(String str, String charset)
    Base64 decodes a string, which is interpreted according to the specified character set
    static byte[]
    encode(byte[] in)
    Base64 encodes an array of bytes
    static byte[]
    encode(byte[] in, int offset, int len)
    Base64 encodes an array of bytes
    static String
    Base64 encodes a string, which is interpreted according to the ISO-8859-1 character set
    static String
    encode(String str, String charset)
    Base64 encodes a string, which is interpreted according to the specified character set

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • Base64

      public Base64()
  • Method Details

    • encode

      public static String encode(String str) throws UnsupportedEncodingException
      Base64 encodes a string, which is interpreted according to the ISO-8859-1 character set
      Parameters:
      str - The string to encode
      Returns:
      The encoded string, generated with the ISO-8859-1 character set
      Throws:
      UnsupportedEncodingException
    • encode

      public static String encode(String str, String charset) throws UnsupportedEncodingException
      Base64 encodes a string, which is interpreted according to the specified character set
      Parameters:
      str - The string to encode
      charset - The character set to interpret the string with
      Returns:
      The encoded string, generated with the specified character set
      Throws:
      UnsupportedEncodingException
    • decode

      public static String decode(String str) throws UnsupportedEncodingException
      Base64 decodes a string, which is interpreted according to the ISO-8859-1 character set
      Parameters:
      str - The string to encode
      Returns:
      The decoded string, generated with the ISO-8859-1 character set
      Throws:
      UnsupportedEncodingException
    • decode

      public static String decode(String str, String charset) throws UnsupportedEncodingException
      Base64 decodes a string, which is interpreted according to the specified character set
      Parameters:
      str - The string to encode
      charset - The character set to interpret the string with
      Returns:
      The decoded string, generated with the specified character set
      Throws:
      UnsupportedEncodingException
    • encode

      public static byte[] encode(byte[] in, int offset, int len)
      Base64 encodes an array of bytes
      Parameters:
      in - The array of bytes to encode
      offset - The starting offset into the array to encode
      len - The number of bytes to encode
      Returns:
      The encoded bytes
    • encode

      public static byte[] encode(byte[] in)
      Base64 encodes an array of bytes
      Parameters:
      in - The array of bytes to encode
      Returns:
      The encoded bytes
    • decode

      public static byte[] decode(byte[] in, int offset, int len)
      Base64 decodes an array of bytes
      Parameters:
      in - The array of bytes to decode
      offset - The starting offset into the array to decode
      len - The number of bytes to decode
      Returns:
      The decoded bytes
    • decode

      public static byte[] decode(byte[] in)
      Base64 decodes an array of bytes
      Parameters:
      in - The array of bytes to decode
      Returns:
      The decoded bytes