public final class

Base64

extends Object
java.lang.Object
   ↳ com.sforce.ws.util.Base64

Class Overview

Unceremoniously lifted from jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/Base64.java Revision 1.8 2002/01/05 11:15:59

Eliminates dependency on sun.misc.Base64Encoding, which isn't appreciated by the J2EE security manager. (it's an access exception to load sun.misc.* classes in application code).

Base64 encoder and decoder.

This class provides encoding/decoding methods for the Base64 encoding as defined by RFC 2045, N. Freed and N. Borenstein. RFC 2045: Multipurpose Internet Mail Extensions (MIME) Part One: Format of Internet Message Bodies. Reference 1996. Available at: http://www.ietf.org/rfc/rfc2045.txt

Summary

Constants
int BASELENGTH
int EIGHTBIT
int FOURBYTE
int LOOKUPLENGTH
byte PAD
int SIGN
int SIXTEENBIT
int TWENTYFOURBITGROUP
Fields
private static final byte[] base64Alphabet
private static byte[] lookUpBase64Alphabet
Public Constructors
Base64()
Public Methods
static byte[] decode(byte[] base64Data)
Decodes Base64 data into octects.
static byte[] encode(byte[] binaryData)
Encodes hex octects into Base64.
[Expand]
Inherited Methods
From class java.lang.Object

Constants

private static final int BASELENGTH

Constant Value: 255 (0x000000ff)

private static final int EIGHTBIT

Constant Value: 8 (0x00000008)

private static final int FOURBYTE

Constant Value: 4 (0x00000004)

private static final int LOOKUPLENGTH

Constant Value: 64 (0x00000040)

private static final byte PAD

Constant Value: 61 (0x0000003d)

private static final int SIGN

Constant Value: -128 (0xffffff80)

private static final int SIXTEENBIT

Constant Value: 16 (0x00000010)

private static final int TWENTYFOURBITGROUP

Constant Value: 24 (0x00000018)

Fields

private static final byte[] base64Alphabet

private static byte[] lookUpBase64Alphabet

Public Constructors

public Base64 ()

Public Methods

public static byte[] decode (byte[] base64Data)

Decodes Base64 data into octects.

Parameters
base64Data Byte array containing Base64 data
Returns
  • Array containing decoded data.

public static byte[] encode (byte[] binaryData)

Encodes hex octects into Base64.

Parameters
binaryData Array containing binaryData
Returns
  • Base64-encoded array