org.modeshape.common.text

## Class UrlEncoder

- java.lang.Object
- - org.modeshape.common.text.UrlEncoder

- All Implemented Interfaces:
    TextDecoder, TextEncoder
  Direct Known Subclasses:
    FilenameEncoder

      @Immutable
      public class UrlEncoder
      extends Object
      implements TextEncoder, TextDecoder

  An encoder useful for converting text to be used within a URL, as defined by Section 2.3 of RFC 2396. Note that this class does not encode a complete URL ( `URLEncoder` and `URLDecoder` should be used for such purposes).

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static char` | `ESCAPE_CHARACTER`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `UrlEncoder()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `String` | `decode(String encodedText)` Return the decoded version of an encoded string
    `String` | `encode(String text)` Returns the encoded version of a string.
    `protected String` | `encode(String text, BitSet safeChars)`
    `boolean` | `isSlashEncoded()`
    `UrlEncoder` | `setSlashEncoded(boolean slashEncoded)`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### ESCAPE_CHARACTER

          public static final char ESCAPE_CHARACTER

      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### UrlEncoder

          public UrlEncoder()

  - ### Method Detail

    - #### encode

          public String encode(String text)

      Description copied from interface: `TextEncoder`
      Returns the encoded version of a string.
      Specified by:
        `encode` in interface `TextEncoder`
      Parameters:
        `text` - the text with characters that are to be encoded.
      Returns:
        the text with the characters encoded as required, or null if the supplied text is null
      See Also:
        `TextDecoder.decode(String)`

    - #### encode

          protected String encode(String text,
                      BitSet safeChars)

    - #### decode

          public String decode(String encodedText)

      Description copied from interface: `TextDecoder`
      Return the decoded version of an encoded string
      Specified by:
        `decode` in interface `TextDecoder`
      Parameters:
        `encodedText` - the encoded text
      Returns:
        the unecoded form of the text, or null if the supplied node name is also null
      See Also:
        `TextEncoder.encode(String)`

    - #### isSlashEncoded

          public boolean isSlashEncoded()

      Returns:
        slashEncoded

    - #### setSlashEncoded

          public UrlEncoder setSlashEncoded(boolean slashEncoded)

      Parameters:
        `slashEncoded` - Sets slashEncoded to the specified value.
      Returns:
        this object, for method chaining

Copyright © 2008-2014 JBoss, a division of Red Hat. All Rights Reserved.