com.planet_ink.coffee_mud.core
Class B64Encoder

java.lang.Object
  extended by com.planet_ink.coffee_mud.core.B64Encoder

public class B64Encoder
extends java.lang.Object

Encodes and decodes to and from Base64 notation. Change Log:

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/base64 periodically to check for updates or to contribute improvements.


Field Summary
static byte[] _NATIVE_ALPHABET
           
static byte[] DECODABET
           
static int DECODE
           
static int DONT_BREAK_LINES
           
static int ENCODE
           
static byte EQUALS_SIGN
           
static byte EQUALS_SIGN_ENC
           
static int GZIP
           
static int MAX_LINE_LENGTH
           
static byte NEW_LINE
           
static int NO_OPTIONS
           
static java.lang.String PREFERRED_ENCODING
           
static byte WHITE_SPACE_ENC
           
 
Method Summary
static byte[] B64decode(byte[] source, int off, int len)
           
static byte[] B64decode(java.lang.String s)
           
static byte[] B64decodeFromFile(java.lang.String filename)
           
static boolean B64decodeToFile(java.lang.String dataToDecode, java.lang.String filename)
           
static java.lang.Object B64decodeToObject(java.lang.String encodedObject)
           
static java.lang.String B64encodeBytes(byte[] source)
           
static java.lang.String B64encodeBytes(byte[] source, int options)
           
static java.lang.String B64encodeBytes(byte[] source, int off, int len)
           
static java.lang.String B64encodeBytes(byte[] source, int off, int len, int options)
           
static java.lang.String B64encodeFromFile(java.lang.String filename)
           
static java.lang.String B64encodeObject(java.io.Serializable serializableObject)
           
static java.lang.String B64encodeObject(java.io.Serializable serializableObject, int options)
           
static boolean B64encodeToFile(byte[] dataToEncode, java.lang.String filename)
           
protected static int decode4to3(byte[] source, int srcOffset, byte[] destination, int destOffset)
           
protected static byte[] encode3to4(byte[] b4, byte[] threeBytes, int numSigBytes)
           
protected static byte[] encode3to4(byte[] source, int srcOffset, int numSigBytes, byte[] destination, int destOffset)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NO_OPTIONS

public static final int NO_OPTIONS
See Also:
Constant Field Values

ENCODE

public static final int ENCODE
See Also:
Constant Field Values

DECODE

public static final int DECODE
See Also:
Constant Field Values

GZIP

public static final int GZIP
See Also:
Constant Field Values

DONT_BREAK_LINES

public static final int DONT_BREAK_LINES
See Also:
Constant Field Values

MAX_LINE_LENGTH

public static final int MAX_LINE_LENGTH
See Also:
Constant Field Values

EQUALS_SIGN

public static final byte EQUALS_SIGN
See Also:
Constant Field Values

NEW_LINE

public static final byte NEW_LINE
See Also:
Constant Field Values

PREFERRED_ENCODING

public static final java.lang.String PREFERRED_ENCODING
See Also:
Constant Field Values

_NATIVE_ALPHABET

public static final byte[] _NATIVE_ALPHABET

DECODABET

public static final byte[] DECODABET

WHITE_SPACE_ENC

public static final byte WHITE_SPACE_ENC
See Also:
Constant Field Values

EQUALS_SIGN_ENC

public static final byte EQUALS_SIGN_ENC
See Also:
Constant Field Values
Method Detail

encode3to4

protected static byte[] encode3to4(byte[] b4,
                                   byte[] threeBytes,
                                   int numSigBytes)

encode3to4

protected static byte[] encode3to4(byte[] source,
                                   int srcOffset,
                                   int numSigBytes,
                                   byte[] destination,
                                   int destOffset)

B64encodeObject

public static java.lang.String B64encodeObject(java.io.Serializable serializableObject)

B64encodeObject

public static java.lang.String B64encodeObject(java.io.Serializable serializableObject,
                                               int options)

B64encodeBytes

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

B64encodeBytes

public static java.lang.String B64encodeBytes(byte[] source,
                                              int options)

B64encodeBytes

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

B64encodeBytes

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

decode4to3

protected static int decode4to3(byte[] source,
                                int srcOffset,
                                byte[] destination,
                                int destOffset)

B64decode

public static byte[] B64decode(byte[] source,
                               int off,
                               int len)

B64decode

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

B64decodeToObject

public static java.lang.Object B64decodeToObject(java.lang.String encodedObject)

B64encodeToFile

public static boolean B64encodeToFile(byte[] dataToEncode,
                                      java.lang.String filename)

B64decodeToFile

public static boolean B64decodeToFile(java.lang.String dataToDecode,
                                      java.lang.String filename)

B64decodeFromFile

public static byte[] B64decodeFromFile(java.lang.String filename)

B64encodeFromFile

public static java.lang.String B64encodeFromFile(java.lang.String filename)