Here you can find the source of getFileContentAsString(File cpfile)
public static String getFileContentAsString(File cpfile)
//package com.java2s; //License from project: Open Source License import java.io.File; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; public class Main { public static String getFileContentAsString(File cpfile) { FileReader in = null;//from ww w .j ava 2 s .c o m try { in = new FileReader(cpfile); } catch (FileNotFoundException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } char[] buffer = new char[128]; int len; String content = ""; try { while ((len = in.read(buffer)) != -1) { content += new String(buffer, 0, len); } } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } return content.trim(); } }