Code example for AssetFileDescriptor

Methods: createInputStream, createOutputStream

0
    if (doOutput) { mode.append("wt"); }
 
    fd = contentResolver.openAssetFileDescriptor(resolverUri, mode.toString());
 
    if (doInput) {
      inputStream = new ContentUriInputStreamWrapper(fd.createInputStream());
    } 
    if (doOutput) {
      outputStream = new ContentUriOutputStreamWrapper(fd.createOutputStream());
    } 
    connected = true;
  } 
 
  void checkClosedStreams() throws IOException { 
    if (!connected) { return; }
    if (fd != null && (inputClosed || inputStream == null) && (outputClosed || outputStream == null)) {
      fd.close();
      fd = null;
    } 
  }