• BlackBerry Dynamics
  • Runtime library for Android applications
  • 12.0.1.79
RFC1522Codec Class Referenceabstract
Inheritance diagram for RFC1522Codec:
BCodec QCodec

Description

Implements methods common to all codecs defined in RFC 1522.

RFC 1522 describes techniques to allow the encoding of non-ASCII text in various portions of a RFC 822 [2] message header, in a manner which is unlikely to confuse existing message handling software.

See also
MIME (Multipurpose Internet Mail Extensions) Part Two: Message Header Extensions for Non-ASCII Text
Author
Apache Software Foundation
Since
1.3
Version
Id
RFC1522Codec.java,v 1.2 2004/04/09 22:21:43 ggregory Exp

Notice

The following notice applies to the original API on which this API is based, and to its documentation. The documentation of this API has been revised from the original.

/*
 * Copyright (C) 2006 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

Protected Member Functions

String encodeText (final String text, final String charset) throws EncoderException, UnsupportedEncodingException
 Applies an RFC 1522 compliant encoding scheme to the given string of text with the given charset. More...
 
String decodeText (final String text) throws DecoderException, UnsupportedEncodingException
 Applies an RFC 1522 compliant decoding scheme to the given string of text. More...
 
abstract String getEncoding ()
 Returns the codec name (referred to as encoding in the RFC 1522) More...
 
abstract byte[] doEncoding (byte[] bytes) throws EncoderException
 Encodes an array of bytes using the defined encoding scheme. More...
 
abstract byte[] doDecoding (byte[] bytes) throws DecoderException
 Decodes an array of bytes using the defined encoding scheme. More...
 

Member Function Documentation

◆ encodeText()

String encodeText ( final String  text,
final String  charset 
) throws EncoderException, UnsupportedEncodingException
protected

This method constructs the "encoded-word" header common to all the RFC 1522 codecs and then invokes (byte []) method of a concrete class to perform the specific enconding.

Parameters
texta string to encode
charseta charset to be used
Returns
RFC 1522 compliant "encoded-word"
Exceptions
EncoderExceptionthrown if there is an error conidition during the Encoding process.
UnsupportedEncodingExceptionthrown if charset is not supported
See also
JRE character encoding names

◆ decodeText()

String decodeText ( final String  text) throws DecoderException, UnsupportedEncodingException
protected

This method processes the "encoded-word" header common to all the RFC 1522 codecs and then invokes (byte []) method of a concrete class to perform the specific deconding.

Parameters
texta string to decode
Exceptions
DecoderExceptionthrown if there is an error conidition during the Decoding process.
UnsupportedEncodingExceptionthrown if charset specified in the "encoded-word" header is not supported

◆ getEncoding()

abstract String getEncoding ( )
abstractprotected
Returns
name of the codec

Reimplemented in QCodec, and BCodec.

◆ doEncoding()

abstract byte [] doEncoding ( byte[]  bytes) throws EncoderException
abstractprotected
Parameters
bytesData to be encoded
Returns
A byte array containing the encoded data
Exceptions
EncoderExceptionthrown if the Encoder encounters a failure condition during the encoding process.

Reimplemented in QCodec, and BCodec.

◆ doDecoding()

abstract byte [] doDecoding ( byte[]  bytes) throws DecoderException
abstractprotected
Parameters
bytesData to be decoded
Returns
a byte array that contains decoded data
Exceptions
DecoderExceptionA decoder exception is thrown if a Decoder encounters a failure condition during the decode process.

Reimplemented in QCodec, and BCodec.