mirror of https://github.com/apache/poi.git
more use of commons-io
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1892670 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
1e6416551e
commit
315beed17c
|
@ -17,11 +17,11 @@
|
||||||
|
|
||||||
package org.apache.poi.openxml4j.opc.internal;
|
package org.apache.poi.openxml4j.opc.internal;
|
||||||
|
|
||||||
import java.io.ByteArrayInputStream;
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
|
|
||||||
|
import org.apache.commons.io.input.UnsynchronizedByteArrayInputStream;
|
||||||
import org.apache.commons.io.output.UnsynchronizedByteArrayOutputStream;
|
import org.apache.commons.io.output.UnsynchronizedByteArrayOutputStream;
|
||||||
import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
|
import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
|
||||||
import org.apache.poi.openxml4j.exceptions.OpenXML4JException;
|
import org.apache.poi.openxml4j.exceptions.OpenXML4JException;
|
||||||
|
@ -88,7 +88,7 @@ public final class MemoryPackagePart extends PackagePart {
|
||||||
if (data == null) {
|
if (data == null) {
|
||||||
data = new byte[0];
|
data = new byte[0];
|
||||||
}
|
}
|
||||||
return new ByteArrayInputStream(data);
|
return new UnsynchronizedByteArrayInputStream(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -17,11 +17,11 @@
|
||||||
|
|
||||||
package org.apache.poi.openxml4j.util;
|
package org.apache.poi.openxml4j.util;
|
||||||
|
|
||||||
import java.io.ByteArrayInputStream;
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
|
|
||||||
import org.apache.commons.compress.archivers.zip.ZipArchiveEntry;
|
import org.apache.commons.compress.archivers.zip.ZipArchiveEntry;
|
||||||
|
import org.apache.commons.io.input.UnsynchronizedByteArrayInputStream;
|
||||||
import org.apache.poi.util.IOUtils;
|
import org.apache.poi.util.IOUtils;
|
||||||
|
|
||||||
|
|
||||||
|
@ -48,6 +48,6 @@ import org.apache.poi.util.IOUtils;
|
||||||
}
|
}
|
||||||
|
|
||||||
public InputStream getInputStream() {
|
public InputStream getInputStream() {
|
||||||
return new ByteArrayInputStream(data);
|
return new UnsynchronizedByteArrayInputStream(data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,7 +27,6 @@ package org.apache.poi.poifs.crypt.dsig.facets;
|
||||||
import static org.apache.poi.ooxml.POIXMLTypeLoader.DEFAULT_XML_OPTIONS;
|
import static org.apache.poi.ooxml.POIXMLTypeLoader.DEFAULT_XML_OPTIONS;
|
||||||
import static org.apache.poi.poifs.crypt.dsig.facets.XAdESSignatureFacet.insertXChild;
|
import static org.apache.poi.poifs.crypt.dsig.facets.XAdESSignatureFacet.insertXChild;
|
||||||
|
|
||||||
import java.io.ByteArrayInputStream;
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.math.BigInteger;
|
import java.math.BigInteger;
|
||||||
import java.security.cert.CRLException;
|
import java.security.cert.CRLException;
|
||||||
|
@ -46,6 +45,7 @@ import java.util.UUID;
|
||||||
|
|
||||||
import javax.xml.crypto.MarshalException;
|
import javax.xml.crypto.MarshalException;
|
||||||
|
|
||||||
|
import org.apache.commons.io.input.UnsynchronizedByteArrayInputStream;
|
||||||
import org.apache.commons.io.output.UnsynchronizedByteArrayOutputStream;
|
import org.apache.commons.io.output.UnsynchronizedByteArrayOutputStream;
|
||||||
import org.apache.logging.log4j.LogManager;
|
import org.apache.logging.log4j.LogManager;
|
||||||
import org.apache.logging.log4j.Logger;
|
import org.apache.logging.log4j.Logger;
|
||||||
|
@ -191,7 +191,7 @@ public class XAdESXLSignatureFacet implements SignatureFacet {
|
||||||
X509CRL crl;
|
X509CRL crl;
|
||||||
try {
|
try {
|
||||||
crl = (X509CRL) this.certificateFactory
|
crl = (X509CRL) this.certificateFactory
|
||||||
.generateCRL(new ByteArrayInputStream(encodedCrl));
|
.generateCRL(new UnsynchronizedByteArrayInputStream(encodedCrl));
|
||||||
} catch (CRLException e) {
|
} catch (CRLException e) {
|
||||||
throw new RuntimeException("CRL parse error: "
|
throw new RuntimeException("CRL parse error: "
|
||||||
+ e.getMessage(), e);
|
+ e.getMessage(), e);
|
||||||
|
|
|
@ -24,7 +24,6 @@ import java.awt.geom.AffineTransform;
|
||||||
import java.awt.geom.Dimension2D;
|
import java.awt.geom.Dimension2D;
|
||||||
import java.awt.geom.Rectangle2D;
|
import java.awt.geom.Rectangle2D;
|
||||||
import java.awt.image.BufferedImage;
|
import java.awt.image.BufferedImage;
|
||||||
import java.io.ByteArrayInputStream;
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.lang.ref.WeakReference;
|
import java.lang.ref.WeakReference;
|
||||||
|
@ -37,6 +36,7 @@ import org.apache.batik.ext.awt.RenderingHintsKeyExt;
|
||||||
import org.apache.batik.ext.awt.image.renderable.ClipRable8Bit;
|
import org.apache.batik.ext.awt.image.renderable.ClipRable8Bit;
|
||||||
import org.apache.batik.gvt.GraphicsNode;
|
import org.apache.batik.gvt.GraphicsNode;
|
||||||
import org.apache.batik.util.XMLResourceDescriptor;
|
import org.apache.batik.util.XMLResourceDescriptor;
|
||||||
|
import org.apache.commons.io.input.UnsynchronizedByteArrayInputStream;
|
||||||
import org.apache.poi.sl.draw.Drawable;
|
import org.apache.poi.sl.draw.Drawable;
|
||||||
import org.apache.poi.sl.draw.ImageRenderer;
|
import org.apache.poi.sl.draw.ImageRenderer;
|
||||||
import org.apache.poi.sl.usermodel.PictureData;
|
import org.apache.poi.sl.usermodel.PictureData;
|
||||||
|
@ -68,7 +68,7 @@ public class SVGImageRenderer implements ImageRenderer {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void loadImage(byte[] data, String contentType) throws IOException {
|
public void loadImage(byte[] data, String contentType) throws IOException {
|
||||||
loadImage(new ByteArrayInputStream(data), contentType);
|
loadImage(new UnsynchronizedByteArrayInputStream(data), contentType);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -20,9 +20,9 @@ package org.apache.poi.xslf.usermodel;
|
||||||
|
|
||||||
import static org.apache.poi.ooxml.POIXMLTypeLoader.DEFAULT_XML_OPTIONS;
|
import static org.apache.poi.ooxml.POIXMLTypeLoader.DEFAULT_XML_OPTIONS;
|
||||||
|
|
||||||
import java.io.ByteArrayInputStream;
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
|
import org.apache.commons.io.input.UnsynchronizedByteArrayInputStream;
|
||||||
import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
|
import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
|
||||||
import org.apache.poi.openxml4j.opc.OPCPackage;
|
import org.apache.poi.openxml4j.opc.OPCPackage;
|
||||||
import org.apache.poi.openxml4j.opc.PackagePart;
|
import org.apache.poi.openxml4j.opc.PackagePart;
|
||||||
|
@ -46,7 +46,7 @@ public class XSLFMetroShape {
|
||||||
public static Shape<?,?> parseShape(byte[] metroBytes)
|
public static Shape<?,?> parseShape(byte[] metroBytes)
|
||||||
throws InvalidFormatException, IOException, XmlException {
|
throws InvalidFormatException, IOException, XmlException {
|
||||||
PackagePartName shapePN = PackagingURIHelper.createPartName("/drs/shapexml.xml");
|
PackagePartName shapePN = PackagingURIHelper.createPartName("/drs/shapexml.xml");
|
||||||
try (OPCPackage pkg = OPCPackage.open(new ByteArrayInputStream(metroBytes))) {
|
try (OPCPackage pkg = OPCPackage.open(new UnsynchronizedByteArrayInputStream(metroBytes))) {
|
||||||
PackagePart shapePart = pkg.getPart(shapePN);
|
PackagePart shapePart = pkg.getPart(shapePN);
|
||||||
CTGroupShape gs = CTGroupShape.Factory.parse(shapePart.getInputStream(), DEFAULT_XML_OPTIONS);
|
CTGroupShape gs = CTGroupShape.Factory.parse(shapePart.getInputStream(), DEFAULT_XML_OPTIONS);
|
||||||
XSLFGroupShape xgs = new XSLFGroupShape(gs, null);
|
XSLFGroupShape xgs = new XSLFGroupShape(gs, null);
|
||||||
|
|
|
@ -17,7 +17,6 @@
|
||||||
|
|
||||||
package org.apache.poi.xssf.usermodel;
|
package org.apache.poi.xssf.usermodel;
|
||||||
|
|
||||||
import java.io.ByteArrayInputStream;
|
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.util.EnumMap;
|
import java.util.EnumMap;
|
||||||
|
@ -29,6 +28,7 @@ import javax.xml.transform.TransformerException;
|
||||||
import javax.xml.transform.dom.DOMSource;
|
import javax.xml.transform.dom.DOMSource;
|
||||||
import javax.xml.transform.stream.StreamResult;
|
import javax.xml.transform.stream.StreamResult;
|
||||||
|
|
||||||
|
import org.apache.commons.io.input.UnsynchronizedByteArrayInputStream;
|
||||||
import org.apache.commons.io.output.StringBuilderWriter;
|
import org.apache.commons.io.output.StringBuilderWriter;
|
||||||
import org.apache.poi.ooxml.util.DocumentHelper;
|
import org.apache.poi.ooxml.util.DocumentHelper;
|
||||||
import org.apache.poi.ss.usermodel.DifferentialStyleProvider;
|
import org.apache.poi.ss.usermodel.DifferentialStyleProvider;
|
||||||
|
@ -410,7 +410,7 @@ public enum XSSFBuiltinTableStyle {
|
||||||
// hack because I can't figure out how to get XMLBeans to parse a sub-element in a standalone manner
|
// hack because I can't figure out how to get XMLBeans to parse a sub-element in a standalone manner
|
||||||
// - build a fake styles.xml file with just this built-in
|
// - build a fake styles.xml file with just this built-in
|
||||||
StylesTable styles = new StylesTable();
|
StylesTable styles = new StylesTable();
|
||||||
styles.readFrom(new ByteArrayInputStream(styleXML(dxfsNode, tableStyleNode).getBytes(StandardCharsets.UTF_8)));
|
styles.readFrom(new UnsynchronizedByteArrayInputStream(styleXML(dxfsNode, tableStyleNode).getBytes(StandardCharsets.UTF_8)));
|
||||||
styleMap.put(builtIn, new XSSFBuiltinTypeStyleStyle(builtIn, styles.getExplicitTableStyle(styleName)));
|
styleMap.put(builtIn, new XSSFBuiltinTypeStyleStyle(builtIn, styles.getExplicitTableStyle(styleName)));
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
|
|
|
@ -19,13 +19,13 @@ package org.apache.poi.xssf.usermodel;
|
||||||
|
|
||||||
import static org.apache.poi.ooxml.POIXMLTypeLoader.DEFAULT_XML_OPTIONS;
|
import static org.apache.poi.ooxml.POIXMLTypeLoader.DEFAULT_XML_OPTIONS;
|
||||||
|
|
||||||
import java.io.ByteArrayInputStream;
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
|
|
||||||
import javax.xml.namespace.QName;
|
import javax.xml.namespace.QName;
|
||||||
|
|
||||||
|
import org.apache.commons.io.input.UnsynchronizedByteArrayInputStream;
|
||||||
import org.apache.commons.io.output.UnsynchronizedByteArrayOutputStream;
|
import org.apache.commons.io.output.UnsynchronizedByteArrayOutputStream;
|
||||||
import org.apache.poi.ooxml.POIXMLException;
|
import org.apache.poi.ooxml.POIXMLException;
|
||||||
import org.apache.poi.openxml4j.opc.PackagePart;
|
import org.apache.poi.openxml4j.opc.PackagePart;
|
||||||
|
@ -57,7 +57,7 @@ public class XSSFChartSheet extends XSSFSheet {
|
||||||
@Override
|
@Override
|
||||||
protected void read(InputStream is) throws IOException {
|
protected void read(InputStream is) throws IOException {
|
||||||
//initialize the supeclass with a blank worksheet
|
//initialize the supeclass with a blank worksheet
|
||||||
super.read(new ByteArrayInputStream(BLANK_WORKSHEET));
|
super.read(new UnsynchronizedByteArrayInputStream(BLANK_WORKSHEET));
|
||||||
|
|
||||||
try {
|
try {
|
||||||
chartsheet = ChartsheetDocument.Factory.parse(is, DEFAULT_XML_OPTIONS).getChartsheet();
|
chartsheet = ChartsheetDocument.Factory.parse(is, DEFAULT_XML_OPTIONS).getChartsheet();
|
||||||
|
|
Loading…
Reference in New Issue