I’m loading an XML file with this method:
public static String readTextFile(String fullPathFilename) throws IOException {
StringBuffer sb = new StringBuffer(1024);
BufferedReader reader = new BufferedReader(new FileReader(fullPathFilename));
char[] chars = new char[1024];
while(reader.read(chars) > -1){
sb.append(String.valueOf(chars));
}
reader.close();
return sb.toString();
}
But it doesn’t load the whole data. Instead of 25634 characters, it loads 10 less (25624). Why is that?
Thanks,
Ivan
With
BufferedReaderyou get the readLine()-Method, which works well for me.