package com.heima.test;
import java.io.BufferedOutputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.Scanner;
public class Test14 {
/**键盘录入 写入文件 quit时 结束
* @param args
* @throws IOException
*/
public static void main(String[] args) throws IOException {
BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream("text.txt"));
Scanner sc = new Scanner(System.in);
System.out.println("键盘录入数据!quit时结束!");
while(true){
String line = sc.nextLine();
if("quit".equals(line)){
System.out.println("结束键盘录入!");
break;
}else{
bos.write(line.getBytes());
bos.write("\r\n".getBytes());
}
}
bos.close();
}
}