Code example for DataOutputStream

Methods: close, writeBytes

0
		else 
			return false; 
	} 
	public static Process runSuCommandAsync(Context context, String command) throws IOException
	{ 
		DataOutputStream fout = new DataOutputStream(context.openFileOutput(SCRIPT_NAME, 0));
		fout.writeBytes(command);
		fout.close();
		 
		String[] args = new String[] { "su", "-c", ". " + context.getFilesDir().getAbsolutePath() + "/" + SCRIPT_NAME };
		Process proc = Runtime.getRuntime().exec(args);
		return proc; 
	} 
 
	public static int runSuCommand(Context context, String command) throws IOException, InterruptedException
	{ 
		return runSuCommandAsync(context, command).waitFor();
	} 
	 
	public static int runSuCommandNoScriptWrapper(String command) throws IOException, InterruptedException
	{