From f26c5c8468f87fc65533b43f4fe1a9e854ec2065 Mon Sep 17 00:00:00 2001 From: Nick Burch Date: Wed, 12 Jul 2006 11:22:50 +0000 Subject: [PATCH] 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 --- .../poi/hwpf/extractor/WordExtractor.java | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/scratchpad/src/org/apache/poi/hwpf/extractor/WordExtractor.java b/src/scratchpad/src/org/apache/poi/hwpf/extractor/WordExtractor.java index d34fa78c26..d1422288f4 100644 --- a/src/scratchpad/src/org/apache/poi/hwpf/extractor/WordExtractor.java +++ b/src/scratchpad/src/org/apache/poi/hwpf/extractor/WordExtractor.java @@ -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; @@ -47,6 +48,23 @@ public class WordExtractor { public WordExtractor(HWPFDocument doc) throws IOException { 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 "); + 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 -- 2.39.5