Package org.owasp.esapi.codecs.ref
Class EncodingPatternPreservation
- java.lang.Object
-
- org.owasp.esapi.codecs.ref.EncodingPatternPreservation
-
public class EncodingPatternPreservation extends java.lang.ObjectString mutation utility which can be used to replace all occurrences of a defined regular expression with a marker string, and also restore the original string content.
-
-
Constructor Summary
Constructors Constructor Description EncodingPatternPreservation(java.util.regex.Pattern pattern)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringcaptureAndReplaceMatches(java.lang.String input)Replaces each matching instance of this instance's Pattern with an identifiable replacement marker.voidreset()Clears any stored replacement values out of the instance.java.lang.StringrestoreOriginalContent(java.lang.String input)Replaces each instance of thereplacementMarkerwith the original content, as captured bycaptureAndReplaceMatches(String)voidsetReplacementMarker(java.lang.String marker)Allows the marker used as a replacement to be altered.
-
-
-
Method Detail
-
captureAndReplaceMatches
public java.lang.String captureAndReplaceMatches(java.lang.String input)
Replaces each matching instance of this instance's Pattern with an identifiable replacement marker.
After the encoding process is complete, userestoreOriginalContent(String)to re-insert the original data.- Parameters:
input- String to adjust- Returns:
- The adjusted String
-
restoreOriginalContent
public java.lang.String restoreOriginalContent(java.lang.String input)
Replaces each instance of thereplacementMarkerwith the original content, as captured bycaptureAndReplaceMatches(String)- Parameters:
input- String to restore.- Returns:
- String reference with all values replaced.
-
setReplacementMarker
public void setReplacementMarker(java.lang.String marker)
Allows the marker used as a replacement to be altered.- Parameters:
marker- String replacment to use for regex matches.
-
reset
public void reset()
Clears any stored replacement values out of the instance.
-
-