Class Base64

java.lang.Object
org.jfree.xml.util.Base64

public class Base64 extends Object
Provides encoding of raw bytes to base64-encoded characters, and decoding of base64 characters to raw bytes. date: 06 August 1998 modified: 14 February 2000 modified: 22 September 2000
Version:
1.3
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private static char[]
     
    private static byte[]
     
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    private
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static byte[]
    decode(char[] data)
    Decodes a BASE-64 encoded stream to recover the original data.
    static char[]
    encode(byte[] data)
    returns an array of base64-encoded characters to represent the passed data array.
    static void
    main(String[] args)
    Entry point.
    private static byte[]
     
    private static char[]
     
    private static void
    writeBytes(File file, byte[] data)
     
    private static void
    writeChars(File file, char[] data)
     

    Methods inherited from class java.lang.Object

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

    • alphabet

      private static char[] alphabet
    • codes

      private static byte[] codes
  • Constructor Details

    • Base64

      private Base64()
  • Method Details

    • encode

      public static char[] encode(byte[] data)
      returns an array of base64-encoded characters to represent the passed data array.
      Parameters:
      data - the array of bytes to encode
      Returns:
      base64-coded character array.
    • decode

      public static byte[] decode(char[] data)
      Decodes a BASE-64 encoded stream to recover the original data. White space before and after will be trimmed away, but no other manipulation of the input will be performed. As of version 1.2 this method will properly handle input containing junk characters (newlines and the like) rather than throwing an error. It does this by pre-parsing the input and generating from that a count of VALID input characters.
      Parameters:
      data - the character data.
      Returns:
      The decoded data.
    • main

      public static void main(String[] args)
      Entry point.
      Parameters:
      args - the command line arguments.
    • readBytes

      private static byte[] readBytes(File file)
    • readChars

      private static char[] readChars(File file)
    • writeBytes

      private static void writeBytes(File file, byte[] data)
    • writeChars

      private static void writeChars(File file, char[] data)