mirror of
https://github.com/vanitasvitae/Smack.git
synced 2024-11-22 20:12:07 +01:00
XmlStringBuilder: Use potential length for target StringBuilder
This commit is contained in:
parent
fb3a71a14d
commit
8086a11c6c
1 changed files with 3 additions and 1 deletions
|
@ -628,7 +628,9 @@ public class XmlStringBuilder implements Appendable, CharSequence, Element {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CharSequence toXML(XmlEnvironment enclosingXmlEnvironment) {
|
public CharSequence toXML(XmlEnvironment enclosingXmlEnvironment) {
|
||||||
StringBuilder res = new StringBuilder();
|
// This is only the potential length, since the actual length depends on the given XmlEnvironment.
|
||||||
|
int potentialLength = length();
|
||||||
|
StringBuilder res = new StringBuilder(potentialLength);
|
||||||
try {
|
try {
|
||||||
appendXmlTo(res, enclosingXmlEnvironment);
|
appendXmlTo(res, enclosingXmlEnvironment);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
|
|
Loading…
Reference in a new issue