//从 assets 中读取 txt
private String getConfigJSON(Context context) {
BufferedInputStream bis = null;
ByteArrayOutputStream bos = new ByteArrayOutputStream();
try {
bis = new BufferedInputStream(context.getAssets().open(“filename.txt”));
byte[] buffer = new byte[4096];
int readLen = -1;
while ((readLen = bis.read(buffer)) > 0) {
bos.write(buffer, 0, readLen);
}
} catch (IOException e) {
Log.e("", “IOException :” + e.getMessage());
} finally {
if(bis != null){
try {
bis.close();
} catch (IOException e) {
}
}
}
return bos.toString();
}