I want to read the file content of cordova asset index.html file using Java. This is the code I am currently using.
Path filePath = Paths.get("file:///android_asset/www/index.html");
Charset charset = StandardCharsets.UTF_8;
try {
List<String> lines = Files.readAllLines(filePath, charset);
for(String line: lines) {
System.out.println(line);
}
} catch (IOException ex) {
System.out.format("I/O error: %s%n", ex);
}
I get the following error message: I/O error: java.nio.file.NoSuchFileException: file:/android_asset/www/index.html
I have also tried setting file path to "index.html" and "www/index.html" which also shows the same error. I just don't know which path I have to use here.