• BlackBerry Dynamics
  • Runtime library for Android applications
  • 12.0.1.79
QCodec Class Reference
Inheritance diagram for QCodec:
RFC1522Codec StringEncoder StringDecoder Encoder Decoder

Description

Similar to the Quoted-Printable content-transfer-encoding defined in RFC 1521 and designed to allow text containing mostly ASCII characters to be decipherable on an ASCII terminal without decoding.

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
QCodec.java,v 1.6 2004/05/24 00:24:32 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.
 */

Public Member Functions

 QCodec ()
 Default constructor.
 
 QCodec (final String charset)
 Constructor which allows for the selection of a default charset. More...
 
String encode (final String pString, final String charset) throws EncoderException
 Encodes a string into its quoted-printable form using the specified charset. More...
 
String encode (String pString) throws EncoderException
 Encodes a string into its quoted-printable form using the default charset. More...
 
String decode (String pString) throws DecoderException
 Decodes a quoted-printable string into its original form. More...
 
Object encode (Object pObject) throws EncoderException
 Encodes an object into its quoted-printable form using the default charset. More...
 
Object decode (Object pObject) throws DecoderException
 Decodes a quoted-printable object into its original form. More...
 
String getDefaultCharset ()
 The default charset used for string decoding and encoding. More...
 
boolean isEncodeBlanks ()
 Tests if optional tranformation of SPACE characters is to be used. More...
 
void setEncodeBlanks (boolean b)
 Defines whether optional tranformation of SPACE characters is to be used. More...
 

Protected Member Functions

String getEncoding ()
 Returns the codec name (referred to as encoding in the RFC 1522) More...
 
byte[] doEncoding (byte[] bytes) throws EncoderException
 Encodes an array of bytes using the defined encoding scheme. More...
 
byte[] doDecoding (byte[] bytes) throws DecoderException
 Decodes an array of bytes using the defined encoding scheme. More...
 
- Protected Member Functions inherited from RFC1522Codec
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...
 

Constructor & Destructor Documentation

◆ QCodec()

QCodec ( final String  charset)
Parameters
charsetthe default string charset to use.
See also
JRE character encoding names

Member Function Documentation

◆ getEncoding()

String getEncoding ( )
protected
Returns
name of the codec

Reimplemented from RFC1522Codec.

◆ doEncoding()

byte [] doEncoding ( byte[]  bytes) throws EncoderException
protected
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 from RFC1522Codec.

◆ doDecoding()

byte [] doDecoding ( byte[]  bytes) throws DecoderException
protected
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 from RFC1522Codec.

◆ encode() [1/3]

String encode ( final String  pString,
final String  charset 
) throws EncoderException

Unsafe characters are escaped.

Parameters
pStringstring to convert to quoted-printable form
charsetthe charset for pString
Returns
quoted-printable string
Exceptions
EncoderExceptionthrown if a failure condition is encountered during the encoding process.

◆ encode() [2/3]

String encode ( String  pString) throws EncoderException

Unsafe characters are escaped.

Parameters
pStringstring to convert to quoted-printable form
Returns
quoted-printable string
Exceptions
EncoderExceptionthrown if a failure condition is encountered during the encoding process.

Implements StringEncoder.

◆ decode() [1/2]

String decode ( String  pString) throws DecoderException

Escaped characters are converted back to their original representation.

Parameters
pStringquoted-printable string to convert into its original form
Returns
original string
Exceptions
DecoderExceptionA decoder exception is thrown if a failure condition is encountered during the decode process.

Implements StringDecoder.

◆ encode() [3/3]

Object encode ( Object  pObject) throws EncoderException

Unsafe characters are escaped.

Parameters
pObjectobject to convert to quoted-printable form
Returns
quoted-printable object
Exceptions
EncoderExceptionthrown if a failure condition is encountered during the encoding process.

Implements Encoder.

◆ decode() [2/2]

Object decode ( Object  pObject) throws DecoderException

Escaped characters are converted back to their original representation.

Parameters
pObjectquoted-printable object to convert into its original form
Returns
original object
Exceptions
DecoderExceptionA decoder exception is thrown if a failure condition is encountered during the decode process.

Implements Decoder.

◆ getDefaultCharset()

String getDefaultCharset ( )
Returns
the default string charset.

◆ isEncodeBlanks()

boolean isEncodeBlanks ( )
Returns
true if SPACE characters are to be transformed, false otherwise

◆ setEncodeBlanks()

void setEncodeBlanks ( boolean  b)
Parameters
btrue if SPACE characters are to be transformed, false otherwise