Java tutorial
//package com.java2s; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; public class Main { static String File2String(String path) { String strReturn = ""; try { File f = new File(path); FileInputStream fis = new FileInputStream(f); byte[] bDoc = new byte[fis.available()]; fis.read(bDoc); strReturn = new String(bDoc); fis.close(); } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } return strReturn; } }