org.owasp.esapi.codecs
Class PercentCodec

java.lang.Object
  extended by org.owasp.esapi.codecs.Codec
      extended by org.owasp.esapi.codecs.PercentCodec

public class PercentCodec
extends Codec

Implementation of the Codec interface for percent encoding (aka URL encoding).

Since:
June 1, 2007
Author:
Jeff Williams (jeff.williams .at. aspectsecurity.com) Aspect Security
See Also:
Encoder

Constructor Summary
PercentCodec()
           
 
Method Summary
 java.lang.Character decodeCharacter(PushbackString input)
          Returns the decoded version of the next character from the input string and advances the current character in the PushbackString.
 java.lang.String encodeCharacter(char[] immune, java.lang.Character c)
          Encode a character for URLs
 
Methods inherited from class org.owasp.esapi.codecs.Codec
containsCharacter, decode, encode, getHexForNonAlphanumeric, toHex, toOctal
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PercentCodec

public PercentCodec()
Method Detail

encodeCharacter

public java.lang.String encodeCharacter(char[] immune,
                                        java.lang.Character c)
Encode a character for URLs

Overrides:
encodeCharacter in class Codec
Parameters:
immune - characters not to encode
c - character to encode
Returns:
the encoded string representing c

decodeCharacter

public java.lang.Character decodeCharacter(PushbackString input)
Returns the decoded version of the next character from the input string and advances the current character in the PushbackString. If the current character is not encoded, this method MUST reset the PushbackString. Formats all are legal both upper/lower case: %hh;

Overrides:
decodeCharacter in class Codec
Parameters:
input - encoded character using percent characters (such as URL encoding)
Returns:
the decoded Character


Copyright © 2011 The Open Web Application Security Project (OWASP). All Rights Reserved.