FileDocCategorySizeDatePackage
StringExtractor.javaAPI DocExample962Sun Mar 28 19:06:22 BST 1999None

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 {
      FileInputStream fin = 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);
      int b;
      while ((b = fin.read()) != -1) pout.write(b);
      // Alternately
      // StreamCopier.copy(fin, pout);
    }
    catch (FileNotFoundException e) {
      System.out.println("Usage: java StringExtractor inFile outFile");  
    }
    catch (IOException e) {
      System.err.println(e);  
    }