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

## oracle.portal.utils.v1
Class MultiByteEncoder

    java.lang.Object
      |
      +--oracle.portal.utils.v1.MultiByteEncoder

public class MultiByteEncoder
extends java.lang.Object

The class contains a utility method for encoding an arbitrary `String` using the set of characters allowed in a URI, as defined in RFC 2396 - "Uniform Resource Identifiers (URI): Generic Syntax". The method does not suffer from the limitations of the `java.net.URLEncoder` in that it provides control over the character encoding used for character to byte conversions and is capable of encoding characters that are encoded by a sequence of several bytes.

To convert a `String`, each character is examined in turn:

- The ASCII characters '`a`' through '`z`', '`A`' through '`Z`', and '`0`' through '`9`' remain the same.
- Additional 'mark characters', i.e. '`-`', '`_`', '`.`', '`!`', '`~`', '`*`', '`'`' , '`(`', '`)`', remain the same.
- The space character '`` ' is converted into a plus sign '`+`'.
- All other characters are converted into a sequence of bytes using the specified IANA character encoding, and each of these bytes is then encoded as a string "`%xy`", where xy is the two-digit hexadecimal representation of the byte value.

Constructor Summary
`MultiByteEncoder()`

Method Summary
`static java.lang.String` | `encode(java.lang.String value, java.lang.String encoding)` Encodes a String using the set of characters allowed in a URI.
`static java.lang.String` | `encodeUTF(java.lang.String value)` Encodes a String using the set of characters allowed in a URI.

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

Constructor Detail

### MultiByteEncoder

    public MultiByteEncoder()

Method Detail

### encode

    public static java.lang.String encode(java.lang.String value,
                                          java.lang.String encoding)
                                   throws java.io.UnsupportedEncodingException

  Encodes a String using the set of characters allowed in a URI.
  Parameters:
    `value` - `String` to be translated.
    `encoding` - the IANA character encoding to be used to convert non-ASCII characters into bytes (e.g. `"UTF-8"`).
  Returns:
    the translated `String`.
  Throws:
    java.io.UnsupportedEncodingException - if the given encoding is not a supported IANA character encoding.

### encodeUTF

    public static java.lang.String encodeUTF(java.lang.String value)

  Encodes a String using the set of characters allowed in a URI. This method encodes a multibyte string in UTF-8
  Parameters:
    `value` - `String` to be translated.
  Returns:
    the translated `String`.

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