Overview | Package | Class | Tree | Deprecated | Index | Help
| Copyright © 2006 BEA Systems, Inc. All Rights Reserved
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.compoze.collab.util
Class Utf7Utility

    java.lang.Object
      com.compoze.collab.util.Utf7Utility

    public class Utf7Utility

extends Object

Utility methods for decoding UTF-7 encoded messages.

Field Summary
`static String` | `UTF_7`

Method Summary
`static int` | `decodeFromUtf7(byte[] yBytes, int iByteCount, char[] cChars)` Decode an array of bytes representing a UTF-7 encoding into the corresponding characters.
`static String` | `decodeUtf7Text(String sEtext)` Decode "unstructured" headers encoded in UTF-7, that is, headers that are defined as '*text' as per RFC 822.
`static String` | `decodeUtf7Word(String sEword)` The string is parsed using the rules in RFC 2047 for parsing an "encoded-word".
`static Object` | `getContent(Part part)` Get the content of a `Part`, properly handling parts that use the UTF-7 character set.
`static Reader` | `newInputStreamReader(InputStream in, String sEnc)` Return a `Reader` for an `InputStream` for any of the normal supported encodings or "UTF-7".

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### UTF_7

    public static final String UTF_7

See Also
  Constants Summary

Method Detail

### decodeUtf7Text

    public static String decodeUtf7Text(String sEtext)
                                 throws UnsupportedEncodingException

  Decode "unstructured" headers encoded in UTF-7, that is, headers that are defined as '*text' as per RFC 822.

  The string is decoded using the algorithm specified in RFC 2047, Section 6.1.1. If the charset-conversion fails for any sequence, an UnsupportedEncodingException is thrown. If the String is not an RFC 2047 style encoded header, it is returned as-is

  Parameters
    `sEtext` - the possibly encoded value
  Throws
    `UnsupportedEncodingException` - if the charset conversion failed.

### decodeUtf7Word

    public static String decodeUtf7Word(String sEword)
                                 throws ParseException,
                                        UnsupportedEncodingException

  The string is parsed using the rules in RFC 2047 for parsing an "encoded-word". If the parse fails, a ParseException is thrown. Otherwise, it is transfer-decoded, and then charset-converted into Unicode. If the charset-conversion fails, an UnsupportedEncodingException is thrown.

  Parameters
    `sEword` - the possibly encoded value
  Throws
    `ParseException` - if the string is not an encoded-word as per RFC 2047.
    `UnsupportedEncodingException` - if the charset is not UTF-7.

### decodeFromUtf7

    public static int decodeFromUtf7(byte[] yBytes,
                                     int iByteCount,
                                     char[] cChars)
                              throws CharConversionException

  Decode an array of bytes representing a UTF-7 encoding into the corresponding characters.

  Parameters
    `yBytes` - the bytes to decode.
    `iByteCount` - the number of bytes to decode.
    `cChars` - the output buffer. Making cChars as long as yBytes is always sufficient.
  Returns
    the number of decoded characters.
  Throws
    `CharConversionException` - if yBytes is not a valid UTF-7 encoding or cChars is not large enough

### newInputStreamReader

    public static Reader newInputStreamReader(InputStream in,
                                              String sEnc)
                                       throws UnsupportedEncodingException

  Return a `Reader` for an `InputStream` for any of the normal supported encodings or "UTF-7".

  Parameters
    `in` - the InputStream to read from
    `sEnc` - the encoding
  Returns
    an appropriate Reader
  Throws
    `UnsupportedEncodingException` - if sEnc is neither "UTF-7" nor one of the built-in encodings

### getContent

    public static Object getContent(Part part)
                             throws MessagingException,
                                    IOException

  Get the content of a `Part`, properly handling parts that use the UTF-7 character set.

  Parameters
    `part` - the Part
  Returns
    its content
  Throws
    `MessagingException`
    `IOException`

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2006 BEA Systems, Inc. All Rights Reserved