public static String readFileFromAssets(Context context, String fileName) { String res = ""; try { InputStream in = context.getResources().getAssets().open(fileName); int length = in.available(); byte[] buffer = new byte[length]; in.read(buffer); in.close(); res = new String(buffer, "UTF-8"); } catch (Exception e) { e.printStackTrace(); } return res; }
Android 原样输出Assets内容
最新推荐文章于 2023-04-18 14:32:16 发布