com.partnersoft.formats.base64
Class Base64Lib

java.lang.Object
  extended by com.partnersoft.formats.base64.Base64Lib
All Implemented Interfaces:
Lib

public class Base64Lib
extends java.lang.Object
implements Lib

Methods for encoding and decoding to and from Base64 notation.

Much of this class was derived from v2.0.1 source published by Robert Harder at http://iharder.net/base64 and placed in the public domain. Source for this package is available on request from Partner.

Copyright 1997-2006 Partner Software, Inc.

Version:
$Id: Base64Lib.java 1012 2007-11-24 18:30:02Z paul $
Author:
Robert Harder, Paul Reavis, Russell Cagle

Method Summary
static byte[] decode(byte[] source, int off, int len)
          Decodes ASCII characters in the form of a byte array.
static byte[] decode(java.lang.String s)
          Decodes data from Base64 notation.
static java.lang.String encodeBytes(byte[] source)
          Encodes a byte array into Base64 notation.
static java.lang.String encodeBytes(byte[] source, int off, int len)
          Encodes a byte array into Base64 notation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

encodeBytes

public static java.lang.String encodeBytes(byte[] source)
Encodes a byte array into Base64 notation.

Parameters:
source - data to encode
Returns:
encoded data

encodeBytes

public static java.lang.String encodeBytes(byte[] source,
                                           int off,
                                           int len)
Encodes a byte array into Base64 notation.

Parameters:
source - The data to convert
off - Offset in array where conversion should begin
len - Length of data to convert
Returns:
encoded data

decode

public static byte[] decode(byte[] source,
                            int off,
                            int len)
Decodes ASCII characters in the form of a byte array.

Parameters:
source - The Base64 encoded data
off - The offset of where to begin decoding
len - The length of characters to decode
Returns:
decoded data

decode

public static byte[] decode(java.lang.String s)
Decodes data from Base64 notation.

Parameters:
s - the string to decode
Returns:
the decoded data