
ποΈFile Tools
Simple file manipulation
Last updated
KFile.delete("temp.txt);JSONObject jsonData = KFile.readJSONFile("text.json");
if (jsonData == null) {
KLog.abort("Unable to read JSON file");
}JSONObject jsonObject = new JSONObject();
jsonObject.put("lastName", "Smith");
jsonObject.put("firstName", "John");
jsonObject.put("gender", "male");
KFile.writeFile(jsonObject, "test.json");byte[] fileBuffer = KFile.readByteFile("inputFile");
if (!K.isEmpty(fileBuffer) {
KFile.writeBytes(fileBuffer, "outputfile");
}