Code example for FileWriter

Methods: write

0
    } 
 
    public boolean enableInit() { 
        FileWriter wAlive;
        try { 
            wAlive = new FileWriter("/system/tmp/initscript");
            //forgive me but without all the \n's the script is one line long O:-) 
            wAlive.write("#\n#enable init.d script by PropModder\n#\n\n");
            wAlive.write("log -p I -t boot \"Starting init.d ...\"\n");
            wAlive.write("busybox run-parts /system/etc/init.d");
            wAlive.flush();
            wAlive.close();
            cmd.su.runWaitFor("cp -f /system/tmp/initscript /system/usr/bin/init.sh");
            return cmd.su.runWaitFor("chmod 755 /system/usr/bin/pm_init.sh").success();
        } catch(Exception e) {
            Log.e(TAG, "enableInit install failed: " + e);
            e.printStackTrace();
        } 
        return false; 
    }