org.modeshape.common.text

## Class Jsr283Encoder

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

- All Implemented Interfaces:
    TextDecoder, TextEncoder

      @Immutable
      public class Jsr283Encoder
      extends Object
      implements TextEncoder, TextDecoder

  Encoder that escapes characters that are not allowed in JCR names. The mapping defined in Section 3.6.3 of the JSR-283 public review document:

  Non-JCR character (Unicode code point) | Private use Unicode code point
  --- | ---
  (U+002A) | U+F02A
  / (U+002F) | U+F02F
  : (U+003A) | U+F03A
  [ (U+005B) | U+F05B
  ] (U+005D) | U+F05D
  | (U+007C) | U+F07C

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `Jsr283Encoder()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `static boolean` | `containsEncodeableCharacters(String str)`
    `String` | `decode(String jcrNodeName)` Return the decoded version of an encoded string
    `String` | `encode(String publicName)` Returns the encoded version of a string.

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

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

- - ### Constructor Detail

    - #### Jsr283Encoder

          public Jsr283Encoder()

  - ### Method Detail

    - #### containsEncodeableCharacters

          public static boolean containsEncodeableCharacters(String str)

    - #### encode

          public String encode(String publicName)

      Description copied from interface: `TextEncoder`
      Returns the encoded version of a string.
      Specified by:
        `encode` in interface `TextEncoder`
      Parameters:
        `publicName` - 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)`

    - #### decode

          public String decode(String jcrNodeName)

      Description copied from interface: `TextDecoder`
      Return the decoded version of an encoded string
      Specified by:
        `decode` in interface `TextDecoder`
      Parameters:
        `jcrNodeName` - 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)`

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