Print out size of extracted text in CommandLineExtractor
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1763483 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
86eafd3c44
commit
2bfa5a50de
|
@ -33,27 +33,30 @@ public class CommandLineTextExtractor {
|
||||||
System.err.println(" CommandLineTextExtractor <filename> [filename] [filename]");
|
System.err.println(" CommandLineTextExtractor <filename> [filename] [filename]");
|
||||||
System.exit(1);
|
System.exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
for(int i=0; i<args.length; i++) {
|
for (String arg : args) {
|
||||||
System.out.println(DIVIDER);
|
System.out.println(DIVIDER);
|
||||||
|
|
||||||
File f = new File(args[i]);
|
File f = new File(arg);
|
||||||
System.out.println(f);
|
System.out.println(f);
|
||||||
|
|
||||||
POITextExtractor extractor =
|
POITextExtractor extractor =
|
||||||
ExtractorFactory.createExtractor(f);
|
ExtractorFactory.createExtractor(f);
|
||||||
try {
|
try {
|
||||||
POITextExtractor metadataExtractor =
|
POITextExtractor metadataExtractor =
|
||||||
extractor.getMetadataTextExtractor();
|
extractor.getMetadataTextExtractor();
|
||||||
|
|
||||||
System.out.println(" " + DIVIDER);
|
System.out.println(" " + DIVIDER);
|
||||||
System.out.println(metadataExtractor.getText());
|
String metaData = metadataExtractor.getText();
|
||||||
System.out.println(" " + DIVIDER);
|
System.out.println(metaData);
|
||||||
System.out.println(extractor.getText());
|
System.out.println(" " + DIVIDER);
|
||||||
System.out.println(DIVIDER);
|
String text = extractor.getText();
|
||||||
} finally {
|
System.out.println(text);
|
||||||
extractor.close();
|
System.out.println(DIVIDER);
|
||||||
}
|
System.out.println("Had " + metaData.length() + " characters of metadata and " + text.length() + " characters of text");
|
||||||
}
|
} finally {
|
||||||
|
extractor.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue