导读:
ftp://ftp.awl.com/cseng/authors/pohl-mcdowell/source code/
这是一个简化java中输入输出的包。平时自己只是用到其中的少数的几个,
把它贴出来,希望能给学习java的人带来方便。
Console.java
package tio;
import java.io.*;
/**
* The class Console
is a convenience class.
* It contains a static variable in
that is
* initialized to refer to a ReadInput object, reading
* from the standard input stream System.in.
* It also contains a static variable out
* that is initialized to refer to a FormattedWriter,
* writing to the output stream System.out.
*/
public class Console {
public final static ReadInput in =
new ReadInput(new InputStreamReader(System.in));
public final static FormattedWriter out =
new FormattedWriter(System.out);
}
<------------------------------------------------------------------->
ReadException.java
package tio;
import java.io.*;
/**
* The class ReadException
is used to convert
* java.io.IOExceptions into a subtype of
* RuntimeException. By doing this, users of ReadInput
* methods do not need to use throws declarations,
* simplifying beginning programs. Subtypes of
* RuntimeException do not need to be declared using
* a throws clause.
*
* @author C. E. McDowell
* @version 1.1, Released for Java By Dissection
*
*/
public class ReadException extends RuntimeException {
/**
* Constructs a ReadException object with no
* specific message.
*/
public ReadException() {
super();
}
/**
* Constructs a ReadException object with the
* specified message.
*
* @param message the error message
*/
public ReadException(String message) {
super(message);
}