读取Json文件的工具类
作者:
不略 | 来源:发表于
2022-08-27 19:27 被阅读0次public class GetJsonDataUtil {
public String getJson(Context context, String fileName) {
StringBuilder stringBuilder = new StringBuilder();
try {
AssetManager assetManager = context.getAssets();
BufferedReader bf = new BufferedReader(new InputStreamReader(
assetManager.open(fileName)));
String line;
while ((line = bf.readLine()) != null) {
stringBuilder.append(line);
}
} catch (IOException e) {
e.printStackTrace();
}
return stringBuilder.toString();
}
}
本文标题:读取Json文件的工具类
本文链接:https://www.haomeiwen.com/subject/njwfnrtx.html
网友评论