Class GIT.GVU.IMAP.MIME
All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class GIT.GVU.IMAP.MIME

java.lang.Object
   |
   +----GIT.GVU.IMAP.MIME

public class MIME
extends Object
Class to hold tables and functions associated with MIME functions of the toolkit. Generally, these are just some miscellaneous functions that other parts of the toolkit use.

Constructor Index

 o MIME()

Method Index

 o decodeBase64(String)
Given a string, give us the BASE64 decoding of it as a string.
 o decodeUnitBase64(byte[], int, byte[], int)
Thie function will convert an array of input data to an array of output data, one unit at a time.
 o findExtension(String)
Find a filename extension, given a mime type/subtype.

Constructors

 o MIME
  public MIME()

Methods

 o decodeUnitBase64
  public static int decodeUnitBase64(byte input[],
                                     int inIndex,
                                     byte output[],
                                     int outIndex) throws IMAPException, InternalErr
Thie function will convert an array of input data to an array of output data, one unit at a time. A unit is 4 bytes of input data and 3 of output data. It returns the number of bytes actually converted. This is usually 3, but might be 2 or 1 if we are at the end of the data. You should be careful not to call this function when you are past EOF. Note: the input data size should always be a multiple of 4.
Parameters:
byte[] - input the array of input
int - inIndex index of the input byte array to read from (note: this must be 0 mod 4 but isn't checked)
byte[] - output the array of output
int - outIndex index in the output array to write to (note: this must be 0 mod 3 )
Returns:
int the number of input bytes converted. This will be a number from 1 to 4; usually 4. It will be 1, 2, or 3 only at the EOF. Note: Just because its 4 doesn't mean its not EOF if the boundary of the file falls evenly on a 4 byte boundary.
Throws: IMAPException
if the inputted base 64 encoded data has bad characters or too many consecutive = characters
Throws: InternalErr
is thrown if the BASE64 decoder gets confused about its own state
 o decodeBase64
  public static String decodeBase64(String input) throws InternalErr
Given a string, give us the BASE64 decoding of it as a string.
Parameters:
String - s input string to decode
Returns:
a String with the decoded value or NULL if decode failed
Throws: InternalErr
is thrown if the unit decoder gives us a bogus return value
 o findExtension
  public static String findExtension(String mt)
Find a filename extension, given a mime type/subtype.
Parameters:
String - mt MIME Type/Subtype
Returns:
String with the extension (note: if we don't know the MIME type/subtype you give us we return "")

All Packages  Class Hierarchy  This Package  Previous  Next  Index