Improved private method name, newStringWriter to createStringWriter. newStringWriter is too close to new StringWriter
git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/lang/trunk@504316 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
1781d00847
commit
aa5356645e
|
@ -794,7 +794,7 @@ class Entities {
|
||||||
* @return A new escaped <code>String</code>.
|
* @return A new escaped <code>String</code>.
|
||||||
*/
|
*/
|
||||||
public String escape(String str) {
|
public String escape(String str) {
|
||||||
StringWriter stringWriter = newStringWriter(str);
|
StringWriter stringWriter = createStringWriter(str);
|
||||||
this.escape(stringWriter, str);
|
this.escape(stringWriter, str);
|
||||||
return stringWriter.toString();
|
return stringWriter.toString();
|
||||||
}
|
}
|
||||||
|
@ -878,13 +878,12 @@ class Entities {
|
||||||
* @return A new escaped <code>String</code>.
|
* @return A new escaped <code>String</code>.
|
||||||
*/
|
*/
|
||||||
public String unescape(String str) {
|
public String unescape(String str) {
|
||||||
// Make the StringWriter larger than the source String to avoid growing the writer.
|
StringWriter stringWriter = createStringWriter(str);
|
||||||
StringWriter stringWriter = newStringWriter(str);
|
|
||||||
this.unescape(stringWriter, str);
|
this.unescape(stringWriter, str);
|
||||||
return stringWriter.toString();
|
return stringWriter.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
private StringWriter newStringWriter(String str) {
|
private StringWriter createStringWriter(String str) {
|
||||||
// Make the StringWriter 10% larger than the source String to avoid growing the writer
|
// Make the StringWriter 10% larger than the source String to avoid growing the writer
|
||||||
return new StringWriter((int) (str.length() + (str.length() * 0.1)));
|
return new StringWriter((int) (str.length() + (str.length() * 0.1)));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue