## net.i2p.data
Class Base64

    java.lang.Object
      net.i2p.data.Base64

    public class Base64

extends java.lang.Object

Encodes and decodes to and from Base64 notation.

Change Log:

- v1.3.6 - Fixed OutputStream.flush() so that 'position' is reset.
- v1.3.5 - Added flag to turn on and off line breaks. Fixed bug in input stream where last buffer being read, if not completely full, was not returned.
- v1.3.4 - Fixed when "improperly padded stream" error was thrown at the wrong time.
- v1.3.3 - Fixed I/O streams which were totally messed up.

I am placing this code in the Public Domain. Do with it as you will. This software comes with no guarantees or warranties but with plenty of well-wishing instead! Please visit http://iharder.net/xmlizable periodically to check for updates or to contribute improvements.

Modified by jrandom for i2p, using safeEncode / safeDecode to create filesystem and URL safe base64 values (replacing / with ~, and + with -)

Version:
  1.3.4
Author:
  Robert Harder, rob@iharder.net

Method Summary
`static byte[]` `decode(java.lang.String s)`
`static java.lang.String` `decodeToString(java.lang.String s)` Decodes data from Base64 notation and returns it as a string.
`static java.lang.String` `encode(byte[] source)`
`static java.lang.String` `encode(byte[] source, boolean useStandardAlphabet)`
`static java.lang.String` `encode(byte[] source, int off, int len)`
`static java.lang.String` `encode(byte[] source, int off, int len, boolean useStandardAlphabet)`
`static java.lang.String` `encode(java.lang.String source)` added by aum
`static void` `main(java.lang.String[] args)`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Method Detail

### encode

    public static java.lang.String encode(java.lang.String source)

  added by aum

### encode

    public static java.lang.String encode(byte[] source)

### encode

    public static java.lang.String encode(byte[] source,
                                          int off,
                                          int len)

### encode

    public static java.lang.String encode(byte[] source,
                                          boolean useStandardAlphabet)

### encode

    public static java.lang.String encode(byte[] source,
                                          int off,
                                          int len,
                                          boolean useStandardAlphabet)

### decode

    public static byte[] decode(java.lang.String s)

### main

    public static void main(java.lang.String[] args)

### decodeToString

    public static java.lang.String decodeToString(java.lang.String s)

  Decodes data from Base64 notation and returns it as a string. Equivlaent to calling `new String( decode( s ) )`

  Parameters:
    `s` - the strind to decode
  Returns:
    The data as a string
  Since:
    1.4