Reader in = null;
try {
in = new BufferedReader(new FileReader(filename));
char[] buf = new char[4 * 1024]; // 4K char buffer
int charsRead;
while ((charsRead = in.read(buf)) != -1) {
out.write(buf, 0, charsRead);
}
}
finally {
if (in != null) in.close();
}