fix forbidden-apis-check error
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1776817 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
8f1eed63cc
commit
820c8f8fd3
@ -122,7 +122,7 @@ public class OOXMLLister implements Closeable {
|
|||||||
container.close();
|
container.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void main(String[] args) throws Exception {
|
public static void main(String[] args) throws IOException, InvalidFormatException {
|
||||||
if(args.length == 0) {
|
if(args.length == 0) {
|
||||||
System.err.println("Use:");
|
System.err.println("Use:");
|
||||||
System.err.println("\tjava OOXMLLister <filename>");
|
System.err.println("\tjava OOXMLLister <filename>");
|
||||||
|
@ -20,28 +20,34 @@
|
|||||||
==================================================================== */
|
==================================================================== */
|
||||||
package org.apache.poi.dev;
|
package org.apache.poi.dev;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.PrintStream;
|
||||||
|
|
||||||
|
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.PackageAccess;
|
import org.apache.poi.openxml4j.opc.PackageAccess;
|
||||||
import org.apache.poi.util.NullOutputStream;
|
import org.apache.poi.util.NullOutputStream;
|
||||||
import org.apache.poi.xssf.XSSFTestDataSamples;
|
import org.apache.poi.xssf.XSSFTestDataSamples;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.PrintStream;
|
|
||||||
|
|
||||||
public class TestOOXMLLister {
|
public class TestOOXMLLister {
|
||||||
@Test
|
@Test
|
||||||
public void testMain() throws Exception {
|
public void testMain() throws IOException, InvalidFormatException {
|
||||||
File file = XSSFTestDataSamples.getSampleFile("Formatting.xlsx");
|
File file = XSSFTestDataSamples.getSampleFile("Formatting.xlsx");
|
||||||
OOXMLLister.main(new String[] {file.getAbsolutePath()});
|
OOXMLLister.main(new String[] {file.getAbsolutePath()});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testWithPrintStream() throws Exception {
|
public void testWithPrintStream() throws IOException, InvalidFormatException {
|
||||||
File file = XSSFTestDataSamples.getSampleFile("Formatting.xlsx");
|
File file = XSSFTestDataSamples.getSampleFile("Formatting.xlsx");
|
||||||
OOXMLLister lister = new OOXMLLister(OPCPackage.open(file.getAbsolutePath(), PackageAccess.READ), new PrintStream(new NullOutputStream()));
|
PrintStream nullStream = new PrintStream(new NullOutputStream(), true, "UTF-8");
|
||||||
|
OPCPackage opc = OPCPackage.open(file.getAbsolutePath(), PackageAccess.READ);
|
||||||
|
OOXMLLister lister = new OOXMLLister(opc, nullStream);
|
||||||
lister.displayParts();
|
lister.displayParts();
|
||||||
lister.displayRelations();
|
lister.displayRelations();
|
||||||
lister.close();
|
lister.close();
|
||||||
|
opc.close();
|
||||||
|
nullStream.close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user