Created
November 9, 2015 23:05
-
-
Save ghoff/53608a5f3cf746c204a3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.io.BufferedReader; | |
import java.io.File; | |
import java.io.FileReader; | |
import java.io.IOException; | |
public class FileIO { | |
public static void main(String[] args) { | |
// testing in home directory replace HOME before compiling | |
// and create test directory structure resembling what is seen on a Nexus 5X | |
// The directory under fusb301 may? vary from device to device | |
File file = new File("HOME/power/sys/bus/i2c/drivers/fusb301/"); | |
// Reading directory contents | |
File[] files = file.listFiles(); | |
File fclientcur = null; | |
// find device subdirectory | |
for (int i = 0; i < files.length; i++) { | |
if(files[i].isDirectory()) { | |
fclientcur = new File(files[i], "fclientcur"); | |
break; | |
} | |
} | |
if (fclientcur != null && fclientcur.exists()) { | |
try { | |
BufferedReader reader = new BufferedReader(new FileReader(fclientcur)); | |
String line = null; | |
while(true) { | |
line = reader.readLine(); | |
if(line == null) | |
break; | |
System.out.println(line); | |
} | |
} catch(Exception e) {} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment