Here you can find the source of getFileContent(File file)
public static String getFileContent(File file)
//package com.java2s; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; public class Main { public static String getFileContent(File file) { //setPermissions(file.getAbsolutePath()); FileInputStream fin = null; //Log.d("FILE", file.getAbsolutePath()); byte fileContent[] = null; try {/*from w w w . ja v a 2 s . c om*/ fin = new FileInputStream(file); fileContent = new byte[(int) file.length()]; fin.read(fileContent); } catch (FileNotFoundException e) { } catch (IOException ioe) { //System.out.println("Exception while reading file " + ioe); } finally { try { if (fin != null) { fin.close(); fin = null; } } catch (IOException ioe) { //System.out.println("Error while closing stream: " + ioe); } } return new String(fileContent).split("\n")[0]; } }