Class Base64

java.lang.Object
org.webpki.util.Base64

public class Base64 extends Object
Encodes/decodes base64 data.
  • Method Details

    • decode

      public static byte[] decode(String base64)
      Decode base64 string.

      Note that line wraps are ignored.

      Parameters:
      base64 - Encoded data in base64 format
      Returns:
      Decoded data as a byte array
      Throws:
      IllegalArgumentException
    • encode

      public static String encode(byte[] byteArray)
      Encode byte array.

      This method adds no padding or line wraps.

      Parameters:
      byteArray - Binary data
      Returns:
      Encoded data as a base64 string
    • mimeEncode

      public static String mimeEncode(byte[] byteArray)
      Encode byte array.

      This method wraps lines and adds padding.

      Parameters:
      byteArray - Binary data
      Returns:
      Encoded data as a base64 string