Class Base64Helper

java.lang.Object
de.qytera.qtaf.core.util.Base64Helper

public class Base64Helper extends Object
Class that encodes and decodes base64 Strings
  • Constructor Details

    • Base64Helper

      public Base64Helper()
  • Method Details

    • encode

      public static String encode(String input)
      Convert a string to its base64 representation
      Parameters:
      input - String input
      Returns:
      base64 string
    • encodeFileContent

      public static String encodeFileContent(String filepath) throws IOException
      Convert a file content to its base64 representation
      Parameters:
      filepath - Path to a file
      Returns:
      base64 string
      Throws:
      IOException - error if file does not exist
    • decode

      public static String decode(String input)
      Convert a base64 to its original representation
      Parameters:
      input - Base64 String input
      Returns:
      original string
    • decodeFileContent

      public static byte[] decodeFileContent(String filepath) throws IOException
      Convert a base64 file content to its original byte array representation
      Parameters:
      filepath - Path to a file
      Returns:
      original string
      Throws:
      IOException - error if file does not exist
    • decodeFileContentAsString

      public static String decodeFileContentAsString(String filepath) throws IOException
      Convert a base64 file content to its original string representation
      Parameters:
      filepath - Path to a file
      Returns:
      original string
      Throws:
      IOException - error if file does not exist