I'm trying to cat files in Android sysfs, and first I'd like to check if the files exist, and if they are accessible. I'm trying the first step with the following Java code:
String filePath = "/sys/some/path/to/some/file";
try {
File file = getApplicationContext().getFileStreamPath(filePath);
if (file.exists()) {
// do something
} else {
// do something else
}
} catch (IOException e) {
e.printStackTrace();
}
At run time, I get a java.lang.IllegalArgumentException: File /sys/some/path/to/some/file contains a path separator
What am I doing wrong, and how can I check if a file in sysfs is readable?