Here you can find the source of getFileFromAssets(Context context, String file)
public static String getFileFromAssets(Context context, String file)
//package com.java2s; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import android.content.Context; public class Main { public static String getFileFromAssets(Context context, String file) { String contents = ""; BufferedReader reader = null; try {//www. ja v a 2 s . com reader = new BufferedReader(new InputStreamReader(context .getAssets().open(file))); // do reading, usually loop until end of file reading String mLine = reader.readLine(); while (mLine != null) { contents += mLine; mLine = reader.readLine(); } } catch (IOException e) { //log the exception } finally { if (reader != null) { try { reader.close(); } catch (IOException e) { //log the exception } } } return contents; } }