Stericson / RootTools

RootTools Library
1.6k stars 484 forks source link

Not possible to receive binary output from stdout #53

Open Waty opened 8 years ago

Waty commented 8 years ago

Hi,

I've been using the library for a while now, but recently I needed to call the screencap command which outputs the screenshot to either a file or stdout. I'd like to use stdout so I don't have the IO overhead, but the Command class automatically converts the data to Strings, deleting line seperators and other important info.

I was wondering how I could work around the issue or if there is a library that does allow binary output

hacker1024 commented 6 years ago

It might be easier to manually use a root shell in a Process object, (instantiate one with Runtime.getRuntime().exec("su")) and send and receive commands and data with process.getInputStream() and process.getOutputStream().

There's a lot of help online for doing this.