I am getting
open failed:
EACCES (Permission denied)
on the line OutputStream myOutput = new FileOutputStream
I had the same problem (API >= 23).
The solution https://stackoverflow.com/a/13569364/1729501 worked for me, but it was not practical to disconnect app for debugging.
my solution was to install proper adb device driver on Windows. The google USB driver did not work for my device.
STEP 1: Download adb drivers for your device brand.
STEP 2: Go to device manager -> other devices -> look for entries with word "adb" -> select Update driver -> give location in step 1