import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
-import java.io.StringWriter;
import java.nio.charset.StandardCharsets;
import java.util.EnumMap;
import java.util.Map;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
+import org.apache.commons.io.output.StringBuilderWriter;
import org.apache.poi.ooxml.util.DocumentHelper;
import org.apache.poi.ss.usermodel.DifferentialStyleProvider;
import org.apache.poi.ss.usermodel.TableStyle;
// add a dummy node to adjust properly.
dxfsNode.insertBefore(dxfsNode.getOwnerDocument().createElement("dxf"), dxfsNode.getFirstChild());
- StringBuilder sb = new StringBuilder();
+ StringBuilder sb = new StringBuilder(1024);
sb.append("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n")
.append("<styleSheet xmlns=\"http://schemas.openxmlformats.org/spreadsheetml/2006/main\" ")
.append("xmlns:mc=\"http://schemas.openxmlformats.org/markup-compatibility/2006\" ")
return sb.toString();
}
- private static String writeToString(Node node) throws IOException, TransformerException {
- try (StringWriter sw = new StringWriter()){
+ private static String writeToString(Node node) throws TransformerException {
+ try (StringBuilderWriter sw = new StringBuilderWriter(1024)){
Transformer transformer = XMLHelper.newTransformer();
transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes");
transformer.transform(new DOMSource(node), new StreamResult(sw));
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStreamWriter;
-import java.io.StringWriter;
import java.io.Writer;
import java.nio.charset.StandardCharsets;
import java.util.Arrays;
+import org.apache.commons.io.output.StringBuilderWriter;
import org.apache.commons.io.output.UnsynchronizedByteArrayOutputStream;
import org.apache.poi.hslf.record.RecordTypes;
import org.apache.poi.hslf.usermodel.HSLFSlideShow;
dump.dump(out);
out.close();
} else {
- StringWriter out = new StringWriter();
+ StringBuilderWriter out = new StringBuilderWriter(1024);
dump.dump(out);
System.out.println(out);
}
import java.io.File;
import java.io.IOException;
-import java.io.StringWriter;
import java.lang.reflect.Method;
import java.util.List;
import java.util.concurrent.atomic.AtomicInteger;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
+import org.apache.commons.io.output.StringBuilderWriter;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.apache.poi.hpsf.SummaryInformation;
public String getText() throws Exception
{
- StringWriter stringWriter = new StringWriter();
+ StringBuilderWriter stringWriter = new StringBuilderWriter(1024);
DOMSource domSource = new DOMSource( getDocument() );
StreamResult streamResult = new StreamResult( stringWriter );