Add in a main() method, so people can stop moaning
git-svn-id: https://svn.apache.org/repos/asf/jakarta/poi/trunk@421238 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
d64e872005
commit
c8b4f5798c
@ -2,6 +2,7 @@ package org.apache.poi.hwpf.extractor;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.util.Iterator;
|
||||
|
||||
@ -48,6 +49,23 @@ public class WordExtractor {
|
||||
this.doc = doc;
|
||||
}
|
||||
|
||||
/**
|
||||
* Command line extractor, so people will stop moaning that
|
||||
* they can't just run this.
|
||||
*/
|
||||
public static void main(String[] args) throws IOException {
|
||||
if(args.length == 0) {
|
||||
System.err.println("Use:");
|
||||
System.err.println(" java org.apache.poi.hwpf.extractor.WordExtractor <filename>");
|
||||
System.exit(1);
|
||||
}
|
||||
|
||||
// Process the first argument as a file
|
||||
FileInputStream fin = new FileInputStream(args[0]);
|
||||
WordExtractor extractor = new WordExtractor(fin);
|
||||
System.out.println(extractor.getText());
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the text from the word file, as an array with one String
|
||||
* per paragraph
|
||||
|
Loading…
Reference in New Issue
Block a user