import java.io.*;
class SystemInFile
{
public static void main(String[] args)
{
BufferedReader bufr = null;
BufferedWriter bufw = null;
try
{
bufr = BufferedReader(new InputStreamReader(System.in));
bufw = BufferedWriter(new FileWriter("bufw.txt"));
String line = null;
while ((line=bufr.readLine())!=null)
{
bufw.write(line);
bufw.newLine();
bufw.flush();
}
}
catch (Exception e)
{
throw new RuntimeException("存储错误");
}
finally
{
try
{
if(bufr!=null)
bufr.close();
}
catch (Exception ex)
{
throw new RuntimeException("存储错误");
}
try
{
if(bufw!=null)
bufw.close();
}
catch (Exception exc)
{
throw new RuntimeException("存储错误");
}
}
}
}
|
|