FileReader得问题
wbjk 2003-12-07 08:40:49 File file=new File(fileName);
int fileSize=(int)file.length();
int charsReaded=0;
char[] data=new char[fileSize];
FileReader in=new FileReader(file);
while(in.ready())
{
charsReader+=in.read(data,charsReaded,fileSize-charsReaded);
------------有什么用?
}
java api文档:
read public abstract int read(char[] cbuf,
int off,
int len)
cbuf - Destination bufferoff -
Offset at which to start storing characters
len - Maximum number of characters to read
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~为什么要用这个参数啊?知道还有多少字符没有读完有什么意义?