从文本文件中读取内容
读取内容存为String
public static String parseJSONFile(String filename) throws JSONException, IOException {
String content = new String(Files.readAllBytes(Paths.get(filename)))
return content
}
读取内容存为JSONObject
public static JSONObject parseJSONFile2(String filename) throws JSONException, IOException {
String content = new String(Files.readAllBytes(Paths.get(filename)))
return new JSONObject(content)
}
浙公网安备 33010602011771号