All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class cryptix.util.mime.TransferEncoding

java.lang.Object
   |
   +----cryptix.util.mime.TransferEncoding

public abstract class TransferEncoding
extends Object
This abstract class provides an API for encoding and decoding data according to a MIME Content-Transfer-Encoding.

Note: The input to the encoding is always a sequence of bytes. Strictly speaking the output is a sequence of characters, but since for all MIME transfer encodings, these characters are from a subset of both the Unicode and ASCII character repertoires, it is possible to represent the output either as a String or as a byte array.

References:

  1. RFC 2045, Multipurpose Internet Mail Extensions (MIME) Part One, Format of Internet Message Bodies, http://www.imc.org/rfc2045

Copyright © 1995-1997 Systemics Ltd on behalf of the Cryptix Development Team.
All rights reserved.

$Revision: 1.1.1.1 $

Author:
Jill Baker, David Hopwood

Constructor Index

 o TransferEncoding()

Method Index

 o decode(byte[])
Decodes a byte array containing encoded ASCII.
 o decode(String)
Decodes a encoded String.
 o encode(byte[])
Encodes data as a String using this Content-Transfer-Encoding.
 o encodeAsByteArray(byte[])
Encodes data as a byte array using this Content-Transfer-Encoding.

Constructors

 o TransferEncoding
 public TransferEncoding()

Methods

 o encode
 public abstract String encode(byte data[])
Encodes data as a String using this Content-Transfer-Encoding. Line breaks in the output are represented as CR LF.

Returns:
the encoded string.
 o encodeAsByteArray
 public byte[] encodeAsByteArray(byte data[])
Encodes data as a byte array using this Content-Transfer-Encoding. Each character of the output is mapped to its ASCII code point. Line breaks in the output are represented as CR LF (codes 13 and 10).

Returns:
the encoded byte array.
 o decode
 public byte[] decode(byte data[]) throws MIMEFormatException
Decodes a byte array containing encoded ASCII. Characters with ASCII code points <= 32 (this includes whitespace and newlines) are ignored.

Returns:
the decoded data.
Throws: MIMEFormatException
if data contains invalid characters, i.e. not codes 0-32 and the other codes allowed for this encoding, or is otherwise formatted incorrectly.
 o decode
 public abstract byte[] decode(String msg) throws MIMEFormatException
Decodes a encoded String. Characters with ASCII code points <= 32 (this includes whitespace and newlines) are ignored.

Returns:
the decoded data.
Throws: MIMEFormatException
if data contains invalid characters, i.e. not codes 0-32 and the other codes allowed for this encoding, or is otherwise formatted incorrectly.

All Packages  Class Hierarchy  This Package  Previous  Next  Index