import java.io.*;
class SystemInDemo
{
/*
以键盘录入与屏幕输出为例
*/
public static void main(String[] args) throws IOException
{
//改变标准输入与输出设备实例文件复制操作
System.setIn(new FileInputStream(new File("BufferedCopyFileDemo.java")));
System.setOut(new PrintStream(new File("hah.txt")));
//字节流->字符流
//字符流->字节流
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
String line = null;
while((line=br.readLine())!=null)
{
if("over".equals(line))
break;
bw.write(line);
bw.newLine();
bw.flush();
}
br.close();
/*
//读取字节流
InputStream inputStream = System.in;
StringBuilder sb = new StringBuilder();
int ch = 0;
while((ch=inputStream.read())!=-1)
{
if('\r'==ch)
continue;
if('\n'==ch)
{
if(sb.toString().equals("over"))
break;
System.out.println(sb.toString());
sb.delete(0,sb.length());
}
else
sb.append((char)ch);
}
inputStream.close();
*/
}
}
class SystemInDemo
{
/*
以键盘录入与屏幕输出为例
*/
public static void main(String[] args) throws IOException
{
//改变标准输入与输出设备实例文件复制操作
System.setIn(new FileInputStream(new File("BufferedCopyFileDemo.java")));
System.setOut(new PrintStream(new File("hah.txt")));
//字节流->字符流
//字符流->字节流
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
String line = null;
while((line=br.readLine())!=null)
{
if("over".equals(line))
break;
bw.write(line);
bw.newLine();
bw.flush();
}
br.close();
/*
//读取字节流
InputStream inputStream = System.in;
StringBuilder sb = new StringBuilder();
int ch = 0;
while((ch=inputStream.read())!=-1)
{
if('\r'==ch)
continue;
if('\n'==ch)
{
if(sb.toString().equals("over"))
break;
System.out.println(sb.toString());
sb.delete(0,sb.length());
}
else
sb.append((char)ch);
}
inputStream.close();
*/
}
}