FileDocCategorySizeDatePackage
StringExtractor.javaAPI DocExample933Sat Feb 04 05:42:22 GMT 2006None

StringExtractor

public class StringExtractor extends Object

Fields Summary
Constructors Summary
Methods Summary
public static voidmain(java.lang.String[] args)

    
    if (args.length < 1) {
      System.out.println("Usage: java StringExtractor inFile");
      return;
    }
    try {
      InputStream in = new FileInputStream(args[0]);
      OutputStream out;
      if (args.length >= 2) {
        out = new FileOutputStream(args[1]);
      }
      else out = System.out;
      
      // Here's where the output stream is chained
      // to the ASCII output stream.
      PrintableOutputStream pout = new PrintableOutputStream(out);
      for (int c = in.read(); c != -1; c = in.read()) {
          pout.write(c);
      }
      out.close();
    }
    catch (FileNotFoundException e) {
      System.out.println("Usage: java StringExtractor inFile outFile");  
    }
    catch (IOException ex) {
      System.err.println(ex);
    }