]> source.dussan.org Git - poi.git/commitdiff
Print out size of extracted text in CommandLineExtractor
authorDominik Stadler <centic@apache.org>
Wed, 5 Oct 2016 19:59:50 +0000 (19:59 +0000)
committerDominik Stadler <centic@apache.org>
Wed, 5 Oct 2016 19:59:50 +0000 (19:59 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1763483 13f79535-47bb-0310-9956-ffa450edef68

src/ooxml/java/org/apache/poi/extractor/CommandLineTextExtractor.java

index 919539592b4e72b29bcec84a2728086e7e6a6e23..264daa028f419df1b5a5147b7be76fb3e9017400 100644 (file)
@@ -33,27 +33,30 @@ public class CommandLineTextExtractor {
          System.err.println("   CommandLineTextExtractor <filename> [filename] [filename]");
          System.exit(1);
       }
-      
-      for(int i=0; i<args.length; i++) {
-         System.out.println(DIVIDER);
-         
-         File f = new File(args[i]);
-         System.out.println(f);
-         
-         POITextExtractor extractor = 
-            ExtractorFactory.createExtractor(f);
-         try {
-             POITextExtractor metadataExtractor =
-                extractor.getMetadataTextExtractor();
-             
-             System.out.println("   " + DIVIDER);
-             System.out.println(metadataExtractor.getText());
-             System.out.println("   " + DIVIDER);
-             System.out.println(extractor.getText());
-             System.out.println(DIVIDER);
-         } finally {
-             extractor.close();
-         }
-      }
+
+       for (String arg : args) {
+           System.out.println(DIVIDER);
+
+           File f = new File(arg);
+           System.out.println(f);
+
+           POITextExtractor extractor =
+                   ExtractorFactory.createExtractor(f);
+           try {
+               POITextExtractor metadataExtractor =
+                       extractor.getMetadataTextExtractor();
+
+               System.out.println("   " + DIVIDER);
+               String metaData = metadataExtractor.getText();
+               System.out.println(metaData);
+               System.out.println("   " + DIVIDER);
+               String text = extractor.getText();
+               System.out.println(text);
+               System.out.println(DIVIDER);
+               System.out.println("Had " + metaData.length() + " characters of metadata and " + text.length() + " characters of text");
+           } finally {
+               extractor.close();
+           }
+       }
    }
 }