Return to Snippet

Revision: 22187
at January 5, 2010 05:44 by yakafokon


Initial Code
private static String readFileAsString(String filePath) throws java.io.IOException{
    byte[] buffer = new byte[(int) new File(filePath).length()];
    BufferedInputStream f = new BufferedInputStream(new FileInputStream(filePath));
    f.read(buffer);
    return new String(buffer);
}

Initial URL
http://snippets.dzone.com/posts/show/1335

Initial Description


Initial Title
Read a file as String

Initial Tags
file

Initial Language
Java