public class Untitled1 {
public static void writeFileChar() throws Exception {
FileWriter f = new FileWriter("c:\\aa.txt");
InputStream is = System.in;
int c = is.read();
while (((char) c) != 'x') {
f.write(c);
c = is.read();
}
f.close();
is.close();
}
public static void writeFileString() throws Exception {
FileWriter f = new FileWriter("c:\\aa.txt");
BufferedWriter bwr=new BufferedWriter(f);
BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
String c = bf.readLine();
while (!c.equals("stop")) {
bwr.write(c+"\r\n");
c = bf.readLine();
}
bwr.close();
f.close();
bf.close();
}
public static void readFileChar() throws Exception {
FileReader f = new FileReader("c:\\aa.txt");
int c = f.read();
while (c!=-1) {
System.out.print((char)c);
c=f.read();
}
f.close();
}
public static void readFileString() throws Exception {
BufferedReader bf = new BufferedReader(new FileReader("c:\\aa.txt"));
String c = bf.readLine();
while (c!=null)
{
System.out.println(c);
c=bf.readLine();
}
bf.close();
}