import
java.io.
*
;
public class IOStreamTest
... {
public static void main(String args[]) throws IOException
...{
/** *//**FileOutputStream fos=new FileOutputStream("hello123.txt");
OutputStreamWriter osw=new OutputStreamWriter(fos);
BufferedWriter bw=new BufferedWriter(osw);
bw.write("www.163.ciom");
bw.close();*/
/** *//** FileInputStream fis=new FileInputStream("hello123.txt");
InputStreamReader isw=new InputStreamReader(fis);
BufferedReader br=new BufferedReader(isw);
System.out.println(br.readLine());//只能读取一行数据
bw.close();*/
//z字符流到字节流(System.in)之间转换的桥梁
InputStreamReader isw=new InputStreamReader(System.in);
BufferedReader br=new BufferedReader(isw);
String strLine;
while((strLine=br.readLine())!=null)
...{
System.out.println(strLine);
}
}
}
nJava程序语言使用Unicode来表示字符串和字符。
nReader和Writer这两个抽象类主要用来读写字符流。
public class IOStreamTest
... {
public static void main(String args[]) throws IOException
...{
/** *//**FileOutputStream fos=new FileOutputStream("hello123.txt");
OutputStreamWriter osw=new OutputStreamWriter(fos);
BufferedWriter bw=new BufferedWriter(osw);
bw.write("www.163.ciom");
bw.close();*/
/** *//** FileInputStream fis=new FileInputStream("hello123.txt");
InputStreamReader isw=new InputStreamReader(fis);
BufferedReader br=new BufferedReader(isw);
System.out.println(br.readLine());//只能读取一行数据
bw.close();*/
//z字符流到字节流(System.in)之间转换的桥梁
InputStreamReader isw=new InputStreamReader(System.in);
BufferedReader br=new BufferedReader(isw);
String strLine;
while((strLine=br.readLine())!=null)
...{
System.out.println(strLine);
}
}
}
nJava程序语言使用Unicode来表示字符串和字符。
nReader和Writer这两个抽象类主要用来读写字符流。