FileDocCategorySizeDatePackage
StreamPrinter.javaAPI DocExample589Sun Mar 28 19:05:44 BST 1999com.macfaq.io

StreamPrinter.java

package com.macfaq.io;

import java.io.*;

public class StreamPrinter {

  InputStream theInput;

  public static void main(String[] args) {
    StreamPrinter sp = new StreamPrinter(System.in);
    sp.print();
  }

  public StreamPrinter(InputStream in) {
    theInput = in;
  }

  public void print() {

    try {
      while (true) {
        int datum = theInput.read();
        if (datum  == -1) break;
        System.out.println(datum);
      }
    }
    catch (IOException e) {
      System.err.println("Couldn't read from System.in!");
    }

  }

}