Skip to content

Instantly share code, notes, and snippets.

@wfwei
Created May 7, 2012 10:33
Show Gist options
  • Save wfwei/2627138 to your computer and use it in GitHub Desktop.
Save wfwei/2627138 to your computer and use it in GitHub Desktop.
java io
StringBuffer sb = new StringBuffer();
File f = new File(file);
if (f.exists()) {
System.out.println("file not exist");
try {
BufferedReader br = new BufferedReader(new InputStreamReader(
new FileInputStream(f)));
while ((s = br.readLine()) != null) {
sb.append(s);
}
} catch (Exception e) {
e.printStackTrace();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment