RootTools icon indicating copy to clipboard operation
RootTools copied to clipboard

Not possible to receive binary output from stdout

Open Waty opened this issue 8 years ago • 1 comments

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

Waty avatar Apr 14 '16 16:04 Waty

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.

hacker1024 avatar Jan 18 '18 10:01 hacker1024