Posted By

yakafokon on 01/05/10


Tagged

file String


Versions (?)

Read a file as String


 / Published in: Java
 

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

  1. private static String readFileAsString(String filePath) throws java.io.IOException{
  2. byte[] buffer = new byte[(int) new File(filePath).length()];
  3. f.read(buffer);
  4. return new String(buffer);
  5. }

Report this snippet  

You need to login to post a comment.