0

I am writing my DocuemtnProvider for Android OS. My application works with encrypted files. And i should return ParcelFileDescriptor on openDocument method.

I don't want store temp decrypted file. I Just want to override function like getStream() to return CipherInputStream.

Can anyone help me ?

Here is some code:

public static ParcelFileDescriptor prepareFileDescriptor(FileEntry entryForOpening, String mode, Handler handler) throws IOException {
    int parsedMode = ParcelFileDescriptor.parseMode(mode);
    File realFile = FileCache.get().fileFromRelCachePath(entryForOpening);
    //TODO decrypt to temp set it into listener
    FileDescriptorListener listener = new FileDescriptorListener(entryForOpening, parsedMode);
    return ParcelFileDescriptor.open(realFile, parsedMode, handler, listener);
}
Vetalll
  • 3,472
  • 6
  • 24
  • 34
  • see: `openPipeHelper (Uri uri, String mimeType, Bundle opts, T args, PipeDataWriter func)` – pskink Sep 16 '15 at 16:53
  • @pskink , How can it help to me? openPipeHelper returns 2 ParcelFileDescriptor. – Vetalll Sep 17 '15 at 08:35
  • "returns 2 ParcelFileDescriptor" what do you mean? what is 2? – pskink Sep 17 '15 at 08:37
  • Sorry. my mistake. Anyway how should it help to me? – Vetalll Sep 17 '15 at 08:44
  • from docs: A helper function for implementing openTypedAssetFile(Uri, String, Bundle), for creating a data pipe and background thread allowing you **to stream generated data** back to the client. – pskink Sep 17 '15 at 08:45
  • It is content provider. I just returning ParcelFileDescripter and other application just openning a stream. I want to replace default stream with my. – Vetalll Sep 17 '15 at 09:49
  • yes i know what you want to do, that is what openPipeHelper is for – pskink Sep 17 '15 at 09:52

0 Answers0