import java.io.*;
class MyBufferedReader
{
private FileReader fr;
MyBufferedReader(FileReader fr)
{
this.fr = fr;
}
public String myReadLine() throws IOException//一次读一行数据的方法
{
StringBuilder sb = new StringBuilder();
int ch = 0;
while((ch=fr.read()) != -1)
{
if(ch=='\r')
continue;
if(ch=='\n')
return sb.toString();
else
sb.append((char)ch);
}
if(sb.length() != 0)
return sb.toString();
return null;
}
public void myClose() throws IOException
{
fr.close();
}
}
class MyBufferedReader1
{
public static void main(String[] args) throws IOException
{
FileReader fr = new FileReader("啊啊啊.txt");
MyBufferedReader mybuf = new MyBufferedReader(fr);
String line = null;
while((line=mybuf.myReadLine()) != null)
{
System.out.println(line);
}
mybuf.myClose();
}
}