I try to validate the content of a json file but before that, i put that content into a string builder. However, during the call of append method of StringBuilder, i got the following error:
java.io.UncheckedIOException: java.nio.charset.MalformedInputException: Input length = 1
Here is my code :
Path path = Paths.get(dir.getAbsolutePath() + File.separator + file.getName());
StringBuilder data = new StringBuilder();
Stream<String> lines = Files.lines(path);
lines.forEach(line -> data.append(line).append("\n"));
lines.close();
Any idea ?