Code example for DataOutputStream

Methods: flush, writeBytes

0
		try{ 
			Log.d(TAG, "Root-Command ==> su -c \""+command+"\"");
			Process p = rt.exec("su -c sh");
 
			//kanged from http://christophe.vandeplas.com/2010/01/09/change-files-readonly-filesystem-your-android-phone 
			DataOutputStream os = new DataOutputStream(p.getOutputStream());
			os.writeBytes(command + "\n"); os.flush();
			// and finally close the shell 
			os.writeBytes("exit\n"); os.flush();
			//end kangage 
			 
			returncode = p.waitFor();
			if (returncode == 0) {
				return true; 
			}else{ 
				Log.d(TAG, "root command: " + command + " failed with returncode "+ returncode);
				return false; 
			} 
		}catch(Exception e){
			Log.d(TAG, "Root-Command error, return code: " + returncode, e);
			return false;