Java tutorial
//package com.java2s; import java.io.BufferedReader; import java.io.File; import java.io.FileReader; public class Main { public static String readFileToString(String fullPath) throws Exception { File file = new File(fullPath); BufferedReader bufRead = new BufferedReader(new FileReader(file)); StringBuffer strBuf = new StringBuffer(); String readString = null; String readLine = null; while ((readLine = bufRead.readLine()) != null) { strBuf.append(readLine); } readString = strBuf.toString(); return readString; } }