org.modeshape.common.text

## Class FilenameEncoder

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

- All Implemented Interfaces:
    TextDecoder, TextEncoder

      @Immutable
      public class FilenameEncoder
      extends UrlEncoder

  An encoder useful for converting text to be used within a filename on common file systems and operating systems, including Linux, OS X, and Windows XP. This encoder is based upon the `UrlEncoder`, except that it removes the '*' character from the list of safe characters.
  See Also:
    `UrlEncoder`

- - ### Field Summary

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

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `FilenameEncoder()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `String` | `encode(String text)` Returns the encoded version of a string.
    `FilenameEncoder` | `setSlashEncoded(boolean slashEncoded)` Set whether this encoder should use slash encoding.

    - ### Methods inherited from class org.modeshape.common.text.UrlEncoder

      `decode, encode, isSlashEncoded`

    - ### 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

    - #### FilenameEncoder

          public FilenameEncoder()

  - ### Method Detail

    - #### encode

          public String encode(String text)

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

    - #### setSlashEncoded

          public FilenameEncoder setSlashEncoded(boolean slashEncoded)

      Set whether this encoder should use slash encoding.
      Overrides:
        `setSlashEncoded` in class `UrlEncoder`
      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.