Author: scolebourne
Date: Sun Jul 2 03:31:34 2006
New Revision: 418567
URL: http://svn.apache.org/viewvc?rev=418567&view=rev
Log:
Javadoc
Modified:
jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/StringEscapeUtils.java
Modified:
jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/StringEscapeUtils.java
URL:
http://svn.apache.org/viewvc/jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/StringEscapeUtils.java?rev=418567&r1=418566&r2=418567&view=diff
==============================================================================
---
jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/StringEscapeUtils.java
(original)
+++
jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/StringEscapeUtils.java
Sun Jul 2 03:31:34 2006
@@ -438,12 +438,11 @@
* @see <a href="http://www.w3.org/TR/REC-html40/sgml/entities.html">HTML
4.0 Character entity references</a>
* @see <a href="http://www.w3.org/TR/html401/charset.html#h-5.3">HTML
4.01 Character References</a>
* @see <a
href="http://www.w3.org/TR/html401/charset.html#code-position">HTML 4.01 Code
positions</a>
- **/
+ */
public static String escapeHtml(String str) {
if (str == null) {
return null;
}
-
try {
StringWriter writer = new StringWriter ((int)(str.length() * 1.5));
escapeHtml(writer, str);
@@ -455,7 +454,7 @@
return null;
}
}
-
+
/**
* <p>Escapes the characters in a <code>String</code> using HTML entities
and writes
* them to a <code>Writer</code>.</p>
@@ -471,9 +470,9 @@
* Note that the commonly used apostrophe escape character (&apos;)
* is not a legal entity and so is not supported). </p>
*
- * @param writer The <code>Writer</code> to write the result to. This must
not be <code>null</code>.
- * @param string The <code>String</code> to escape. This may be
<code>null</code>.
- *
+ * @param writer the writer receiving the escaped string, not null
+ * @param string the <code>String</code> to escape, may be null
+ * @throws IllegalArgumentException if the writer is null
* @throws IOException when <code>Writer</code> passed throws the
exception from
* calls to the [EMAIL PROTECTED]
Writer#write(int)} methods.
*
@@ -489,14 +488,13 @@
if (writer == null ) {
throw new IllegalArgumentException ("The Writer must not be
null.");
}
-
if (string == null) {
return;
}
-
Entities.HTML40.escape(writer, string);
}
+ //-----------------------------------------------------------------------
/**
* <p>Unescapes a string containing entity escapes to a string
* containing the actual Unicode characters corresponding to the
@@ -512,12 +510,11 @@
* @param str the <code>String</code> to unescape, may be null
* @return a new unescaped <code>String</code>, <code>null</code> if null
string input
* @see #escapeHtml(Writer, String)
- **/
+ */
public static String unescapeHtml(String str) {
if (str == null) {
return null;
}
-
try {
StringWriter writer = new StringWriter ((int)(str.length() * 1.5));
unescapeHtml(writer, str);
@@ -529,7 +526,7 @@
return null;
}
}
-
+
/**
* <p>Unescapes a string containing entity escapes to a string
* containing the actual Unicode characters corresponding to the
@@ -542,23 +539,23 @@
* verbatim into the result string. e.g. "&gt;&zzzz;x" will
* become ">&zzzz;x".</p>
*
- * @param writer writer receiving the unescaped string
+ * @param writer the writer receiving the unescaped string, not null
* @param string the <code>String</code> to unescape, may be null
+ * @throws IllegalArgumentException if the writer is null
* @throws IOException if an IOException occurs
* @see #escapeHtml(String)
- **/
+ */
public static void unescapeHtml(Writer writer, String string) throws
IOException {
if (writer == null ) {
throw new IllegalArgumentException ("The Writer must not be
null.");
}
-
if (string == null) {
return;
}
-
Entities.HTML40.unescape(writer, string);
}
+ //-----------------------------------------------------------------------
/**
* <p>Escapes the characters in a <code>String</code> using XML
entities.</p>
*
@@ -569,16 +566,16 @@
* <p>Supports only the five basic XML entities (gt, lt, quot, amp, apos).
* Does not support DTDs or external entities.</p>
*
- * @param writer writer receiving the unescaped string
+ * @param writer the writer receiving the unescaped string, not null
* @param str the <code>String</code> to escape, may be null
* @return a new escaped <code>String</code>, <code>null</code> if null
string input
+ * @throws IllegalArgumentException if the writer is null
* @see #unescapeXml(java.lang.String)
- **/
+ */
public static void escapeXml(Writer writer, String str) throws IOException
{
if (writer == null ) {
throw new IllegalArgumentException ("The Writer must not be
null.");
}
-
if (str == null) {
return;
}
@@ -598,7 +595,7 @@
* @param str the <code>String</code> to escape, may be null
* @return a new escaped <code>String</code>, <code>null</code> if null
string input
* @see #unescapeXml(java.lang.String)
- **/
+ */
public static String escapeXml(String str) {
if (str == null) {
return null;
@@ -606,6 +603,7 @@
return Entities.XML.escape(str);
}
+ //-----------------------------------------------------------------------
/**
* <p>Unescapes a string containing XML entity escapes to a string
* containing the actual Unicode characters corresponding to the
@@ -614,16 +612,16 @@
* <p>Supports only the five basic XML entities (gt, lt, quot, amp, apos).
* Does not support DTDs or external entities.</p>
*
- * @param writer writer receiving the unescaped string
+ * @param writer the writer receiving the unescaped string, not null
* @param str the <code>String</code> to unescape, may be null
* @return a new unescaped <code>String</code>, <code>null</code> if null
string input
+ * @throws IllegalArgumentException if the writer is null
* @see #escapeXml(String)
- **/
+ */
public static void unescapeXml(Writer writer, String str) throws
IOException {
if (writer == null ) {
throw new IllegalArgumentException ("The Writer must not be
null.");
}
-
if (str == null) {
return;
}
@@ -641,7 +639,7 @@
* @param str the <code>String</code> to unescape, may be null
* @return a new unescaped <code>String</code>, <code>null</code> if null
string input
* @see #escapeXml(String)
- **/
+ */
public static String unescapeXml(String str) {
if (str == null) {
return null;
@@ -649,6 +647,7 @@
return Entities.XML.unescape(str);
}
+ //-----------------------------------------------------------------------
/**
* <p>Escapes the characters in a <code>String</code> to be suitable to
pass to
* an SQL query.</p>
@@ -675,4 +674,3 @@
}
}
-
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]