package com.sandwich.util.io; import java.io.BufferedInputStream; import java.io.File; import java.io.FileInputStream; import java.io.IOException; public class FileUtils { public static String readFileAsString(File file) { byte[] buffer = new byte[(int) file.length()]; BufferedInputStream f = null; try { f = new BufferedInputStream(new FileInputStream(file)); f.read(buffer); } catch (IOException e) { throw new RuntimeException(e); } finally { if (f != null) try { f.close(); } catch (IOException ignored) { } } return new String(buffer); } }