Here you can find the source of readFromFile(String filename)
Parameter | Description |
---|---|
data | a parameter |
private static String readFromFile(String filename)
//package com.java2s; import java.io.File; import java.io.FileInputStream; import java.io.InputStream; public class Main { /**/*from w w w . j a v a2 s .co m*/ * * @param data */ private static String readFromFile(String filename) { File file = new File(filename); byte b[] = null; try { if (file.exists()) { b = new byte[(int) file.length()]; InputStream fi = new FileInputStream(file); fi.read(b); fi.close(); } } catch (Exception e) { return null; } if (null != b) { return new String(b); } return null; } }