FileUtils { public static String file2String(File file) throws IOException { if (file == null || !file.exists() || !file.isFile() || !file.canRead()) { return null; } FileReader reader = null; StringWriter writer = null; try { reader = new FileReader(file); writer = new StringWriter(); char[] cbuf = new char[1024]; int len = 0; while ((len = reader.read(cbuf)) != -1) { writer.write(cbuf, 0, len); } return writer.toString(); } finally { IOUtils.closeQuietly(reader); IOUtils.closeQuietly(writer); } }  static String getBaseDirName(); static String getUserHomeDir(String base); static String file2String(File file); static String file2String(Class clazz, String relativePath, String encoding); static List<String> readLines(File file); static boolean string2File(File file, String data); static boolean cleanDirectory(File dir); static final String LINE_SEPARATOR; }
@Test public void file2String() throws Exception { }