org.modeshape.common.text
Class FilenameEncoder

java.lang.Object
  extended by org.modeshape.common.text.UrlEncoder
      extended by 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
static char ESCAPE_CHARACTER
           
 
Constructor Summary
FilenameEncoder()
           
 
Method Summary
 String encode(String text)
          Returns the encoded version of a string.
 FilenameEncoder setSlashEncoded(boolean slashEncoded)
           
 
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)
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)
Overrides:
setSlashEncoded in class UrlEncoder
Parameters:
slashEncoded - Sets slashEncoded to the specified value.
Returns:
this object, for method chaining


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