简化java输入输出

导读:


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);
}




本文转自
http://www.zhuoda.org/air_tuyh/16886.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值