Package org.eigenbase.xom
Class StringEscaper
java.lang.Object
org.eigenbase.xom.StringEscaper
- All Implemented Interfaces:
Cloneable
StringEscaper
is a utility for replacing special characters
with escape sequences in strings. Initially, a StringEscaper starts out as
an identity transform in the "mutable" state. Call defineEscape as many
times as necessary to set up mappings, and then call makeImmutable() before
using appendEscapedString to actually apply the defined transform. Or, use one of
the global mappings pre-defined here.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic StringEscaper
static StringEscaper
static StringEscaper
static StringEscaper
static StringEscaper
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
Apply an immutable transformation to the given string, writing the results to a string buffer.protected Object
clone()
void
defineEscape
(char from, String to) Map character "from" to escape sequence "to"Apply an immutable transformation to the given string.Create a mutable escaper from an existing escaper, which may already be immutable.void
Call this before attempting to escape strings; after this, defineEscape may not be called again.
-
Field Details
-
xmlEscaper
-
xmlNumericEscaper
-
htmlEscaper
-
urlArgEscaper
-
urlEscaper
-
-
Constructor Details
-
StringEscaper
public StringEscaper()Identity transform
-
-
Method Details
-
defineEscape
Map character "from" to escape sequence "to" -
makeImmutable
public void makeImmutable()Call this before attempting to escape strings; after this, defineEscape may not be called again. -
escapeString
Apply an immutable transformation to the given string. -
appendEscapedString
Apply an immutable transformation to the given string, writing the results to a string buffer. -
clone
-
getMutableClone
Create a mutable escaper from an existing escaper, which may already be immutable.
-