mirror of https://github.com/apache/poi.git
javadocs fixes (jdk8)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1751106 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
356991c8aa
commit
8fda0dc929
|
@ -31,6 +31,8 @@ public abstract class POIXMLTextExtractor extends POITextExtractor {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new text extractor for the given document
|
* Creates a new text extractor for the given document
|
||||||
|
*
|
||||||
|
* @param document the document to extract from
|
||||||
*/
|
*/
|
||||||
public POIXMLTextExtractor(POIXMLDocument document) {
|
public POIXMLTextExtractor(POIXMLDocument document) {
|
||||||
_document = document;
|
_document = document;
|
||||||
|
|
|
@ -22,6 +22,7 @@ import java.io.InputStream;
|
||||||
import java.io.PrintStream;
|
import java.io.PrintStream;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
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.openxml4j.opc.PackagePart;
|
import org.apache.poi.openxml4j.opc.PackagePart;
|
||||||
|
@ -47,28 +48,37 @@ public class OOXMLLister {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Figures out how big a given PackagePart is.
|
* Figures out how big a given PackagePart is.
|
||||||
|
*
|
||||||
|
* @param part the PackagePart
|
||||||
|
* @return the size of the PackagePart
|
||||||
*/
|
*/
|
||||||
public static long getSize(PackagePart part) throws IOException {
|
public static long getSize(PackagePart part) throws IOException {
|
||||||
InputStream in = part.getInputStream();
|
InputStream in = part.getInputStream();
|
||||||
byte[] b = new byte[8192];
|
try {
|
||||||
long size = 0;
|
byte[] b = new byte[8192];
|
||||||
int read = 0;
|
long size = 0;
|
||||||
|
int read = 0;
|
||||||
while(read > -1) {
|
|
||||||
read = in.read(b);
|
while(read > -1) {
|
||||||
if(read > 0) {
|
read = in.read(b);
|
||||||
size += read;
|
if(read > 0) {
|
||||||
}
|
size += read;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return size;
|
||||||
|
} finally {
|
||||||
|
in.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
return size;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Displays information on all the different
|
* Displays information on all the different
|
||||||
* parts of the OOXML file container.
|
* parts of the OOXML file container.
|
||||||
|
* @throws InvalidFormatException if the package relations are invalid
|
||||||
|
* @throws IOException if the package can't be read
|
||||||
*/
|
*/
|
||||||
public void displayParts() throws Exception {
|
public void displayParts() throws InvalidFormatException, IOException {
|
||||||
ArrayList<PackagePart> parts = container.getParts();
|
ArrayList<PackagePart> parts = container.getParts();
|
||||||
for (PackagePart part : parts) {
|
for (PackagePart part : parts) {
|
||||||
disp.println(part.getPartName());
|
disp.println(part.getPartName());
|
||||||
|
@ -91,7 +101,7 @@ public class OOXMLLister {
|
||||||
* relationships between different parts
|
* relationships between different parts
|
||||||
* of the OOXML file container.
|
* of the OOXML file container.
|
||||||
*/
|
*/
|
||||||
public void displayRelations() throws Exception {
|
public void displayRelations() {
|
||||||
PackageRelationshipCollection rels =
|
PackageRelationshipCollection rels =
|
||||||
container.getRelationships();
|
container.getRelationships();
|
||||||
for (PackageRelationship rel : rels) {
|
for (PackageRelationship rel : rels) {
|
||||||
|
|
Loading…
Reference in New Issue