Hi I'm getting this error while sending data through a pipe between two parcelFileDescriptors
java.io.IOException: write failed: EPIPE (Broken pipe)
at libcore.io.IoBridge.write(IoBridge.java:455)
at java.io.FileOutputStream.write(FileOutputStream.java:187)
at com.google.common.io.ByteStreams.copy(ByteStreams.java:179)
at cz.simekadam.android.securedfileprovider.SecuredFileProvider$Pipe.run(SecuredFileProvider.java:161)
Caused by: libcore.io.ErrnoException: write failed: EPIPE (Broken pipe)
at libcore.io.Posix.writeBytes(Native Method)
at libcore.io.Posix.write(Posix.java:202)
at libcore.io.BlockGuardOs.write(BlockGuardOs.java:197)
at libcore.io.IoBridge.write(IoBridge.java:450)
at java.io.FileOutputStream.write(FileOutputStream.java:187)
at com.google.common.io.ByteStreams.copy(ByteStreams.java:179)
at cz.simekadam.android.securedfileprovider.SecuredFileProvider$Pipe.run(SecuredFileProvider.java:161)
This is how I'm copying the data.
static class PipeThread extends Thread {
InputStream input;
OutputStream out;
PipeThread(InputStream inputStream, OutputStream out) {
this.input=inputStream;
this.out=out;
}
@Override
public void run() {
try {
ByteStreams.copy(input, out);
input.close();
out.close();
} catch (IOException e) {
Log.e(getClass().getSimpleName(),
"Exception transferring file", e);
}
}
}
I've found this questions which says is could has something to do with missing root permissions. I consider this not being my issue because of I'm not writing anything to any folder. The example usecase is sharing an image file from my contentProvider to an app like Skithch..Last not least there is a thing driving me crazy..The process finished successfuly, that means the shared image is opened in skitch without any issues..I'm just seing this in my console and I'm kind of aware of it..I gues it shouldn't be there:)
EDIT: I've tested it further and it seems to only being reproducible when an other app is reading from my ContentProvider. Only then there is the exception being thrown.