StreamFile class for easy stream read/write with IOCipher
Ok, I found the best example. I tweaked the TransferThread in this project to make it more flexible.
This also has my hacked jni to create pipes and some of my exploratio on how to hook up all the threads to get around blocking.
On Fri, Aug 23, 2013 at 10:59 AM, Josh Steiner <firstname.lastname@example.org> wrote:
Ok, here was my plan of attack.
Make StreamFile derive from java.io.File. @Override methods such as getAbsolutePath( and getFD(). If this is the firsdt call, create two pipes using JNI, one of in one for out. also spin up two threads to attach to both pipes.
One of the tricky spots here is attaching to the pipes will block the java calls until both ends are hooked up, so you also have to use a thread (AsyncTask) just to do the hooking up. I hacked my way into this and got lost in a deadlock nightmare, but done carefully this should work.
Once all that is setup you can return a real FD or path.
Then @Override the close() method and kill the threads and delete the pipe files.
My reader/writer threads were modeled after this: