org.modeshape.common.text
Class UrlEncoder

java.lang.Object
  extended by 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
static char ESCAPE_CHARACTER
           
 
Constructor Summary
UrlEncoder()
           
 
Method Summary
 String decode(String encodedText)
          Return the decoded version of an encoded string
 String encode(String text)
          Returns the encoded version of a string.
 boolean isSlashEncoded()
           
 UrlEncoder setSlashEncoded(boolean slashEncoded)
           
 
Methods inherited from class java.lang.Object
equals, 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)
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)

decode

public String decode(String encodedText)
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-2010 JBoss, a division of Red Hat. All Rights Reserved.