Slide 35
Slide 35 text
Read JSON from file
private String readJsonFromResources(@NonNull String fileName) {
InputStream inputStream
= getClass().getClassLoader().getResourceAsStream(fileName);
BufferedReader bufferedReader
= new BufferedReader(new InputStreamReader(inputStream));
StringBuilder stringBuilder = new StringBuilder();
try {
String buffer;
while ((buffer = bufferedReader.readLine()) != null) {
stringBuilder.append(buffer);
}
} catch (IOException e) {
fail(e.getMessage(), e);
}
return stringBuilder.toString();
}