Class Base64Coder


  • public class Base64Coder
    extends java.lang.Object
    A Base64 Encoder/Decoder.

    This class is used to encode and decode data in Base64 format as described in RFC 1521.

    Copyright 2003-2009 Christian d'Heureuse, Inventec Informatik AG, Zurich, Switzerland
    This module is multi-licensed and may be used under the terms of any of the following licenses:

    Please contact the author if you need another license.
    This module is provided "as is", without warranties of any kind.
    Home page: www.source-code.biz
    Author: Christian d'Heureuse, Inventec Informatik AG, Zurich, Switzerland
    Multi-licensed: EPL/LGPL/AL/BSD.

    Version history:
    2003-07-22 Christian d'Heureuse (chdh): Module created.
    2005-08-11 chdh: License changed from GPL to LGPL.
    2009-07-16: Additional licenses (EPL/AL) added.
    2009-09-16: Additional license (BSD) added.

    • Constructor Summary

      Constructors 
      Constructor Description
      Base64Coder()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static byte[] decode​(char[] in)
      Decodes Base64 data.
      static char[] encode​(byte[] in)
      Encodes a byte array into Base64 format.
      • Methods inherited from class java.lang.Object

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

      • Base64Coder

        public Base64Coder()
    • Method Detail

      • encode

        public static char[] encode​(byte[] in)
        Encodes a byte array into Base64 format. No blanks or line breaks are inserted.
        Parameters:
        in - an array containing the data bytes to be encoded.
        Returns:
        A character array with the Base64 encoded data.
      • decode

        public static byte[] decode​(char[] in)
        Decodes Base64 data. No blanks or line breaks are allowed within the Base64 encoded data.
        Parameters:
        in - a character array containing the Base64 encoded data.
        Returns:
        An array containing the decoded data bytes.
        Throws:
        java.lang.IllegalArgumentException - if the input is not valid Base64 encoded data.