Code example for FileInputStream

Methods: close, read

0
    private int waitForFBSleep(Boolean sleep){
        /*Wait for the screen to sleep/wake */ 
        String fn = (sleep ? "wait_for_fb_sleep" : "wait_for_fb_wake");
        try{ 
            FileInputStream in = null;
            in=new FileInputStream("/sys/power/" + fn);
            int value =  in.read();
            in.close();
            return(value);
        } 
        catch(IOException e){
            Log.e(TAG,"Error reading /sys/power/" + fn + ": " + e.toString());
            return -1; 
        } 
    } 
 
    private int cpuReadInt(String type){
        /* Read an int from a CPU Freq file */ 
        try{ 
            FileInputStream in = null;
            String ret="";