com.mot.iden.util
Class Base64

java.lang.Object
  extended bycom.mot.iden.util.Base64

public class Base64
extends java.lang.Object

Base64 provide J2ME application to encode and decode with Base64 algorithm


Field Summary
protected static byte[] base64Chars
          Table of the sixty-four characters that are used as the Base64 alphabet: [A-Za-z0-9+/]
protected static byte[] reverseBase64Chars
          Reverse lookup table for the Base64 alphabet.
 
Method Summary
static byte[] decode(byte[] bytes)
          Decode Base64 encoded bytes.
static void decode(java.io.InputStream in, java.io.OutputStream out)
          Provides decoding of base64 streams from InputStream to the OutputStream.
static byte[] encode(byte[] bytes)
          Encodes bytes in Base64.
static void encode(java.io.InputStream in, java.io.OutputStream out, int breakinterval)
          Provides encoding of data from InputStream to base64 via the OutputStream.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

base64Chars

protected static final byte[] base64Chars
Table of the sixty-four characters that are used as the Base64 alphabet: [A-Za-z0-9+/]


reverseBase64Chars

protected static final byte[] reverseBase64Chars
Reverse lookup table for the Base64 alphabet. reversebase64Chars[byte] gives n for the nth Base64 character or negative if a character is not a Base64 character.

Method Detail

encode

public static byte[] encode(byte[] bytes)
Encodes bytes in Base64. Non-printable charaters are not encoded.

Parameters:
bytes - byte[] to encode.
Returns:
byte[] of encoded data.

encode

public static void encode(java.io.InputStream in,
                          java.io.OutputStream out,
                          int breakinterval)
                   throws java.io.IOException
Provides encoding of data from InputStream to base64 via the OutputStream.

Parameters:
in - Stream from which to read data that needs to be encoded.
out - Stream to which to write encoded data.
Throws:
java.io.IOException - if an IO error occurs.

decode

public static byte[] decode(byte[] bytes)
Decode Base64 encoded bytes. Characters that are not part of the Base64 alphabet are ignored in the input.

Parameters:
bytes - The data to decode.
Returns:
Decoded bytes.

decode

public static void decode(java.io.InputStream in,
                          java.io.OutputStream out)
                   throws java.io.IOException
Provides decoding of base64 streams from InputStream to the OutputStream.

Parameters:
in - Stream to read the data to be decoded.
out - Stream to write the decoded data.
Throws:
java.io.IOException - if an IO error occurs.