- /*
- 程序名:DemoBufferedInput.java
- 功能:主要实现过滤流的一些作用。
- 程序员:李显福
- */
- import java.io.*;
- import java.util.*;
- class DemoBufferedInput
- {
- public static void main(String[] args) throws IOException
- {
- File f1=new File("e.doc");
- f1.createNewFile();
- FileOutputStream fos1=new FileOutputStream("e.doc");
- BufferedOutputStream bos1=new BufferedOutputStream(fos1);
- Scanner sc=new Scanner(System.in);
- do
- {
- System.out.println("请输入数据:");
- bos1.write(sc.nextLine().getBytes());
- System.out.println('\n');
- }while(sc.nextLine().compareToIgnoreCase("0")!=0);
- bos1.flush();
- bos1.close();
- }
复制代码 |
|