Here you can find the source of readFile(File target)
public static String readFile(File target)
//package com.java2s; //License from project: Open Source License import java.io.File; import java.io.FileInputStream; public class Main { public static String readFile(File target) { String adhocXml = null;//from ww w . j av a2 s.c o m try { FileInputStream fis = new FileInputStream(target); byte[] all = new byte[(int) target.length()]; fis.read(all); fis.close(); adhocXml = new String(all); return adhocXml; } catch (Throwable e) { throw new RuntimeException(e); } } }