Code example for AssetFileDescriptor

0
                // If the cursor is null, throw an exception 
                throw new FileNotFoundException("Unable to query " + uri);
            } 
 
            // Start a new thread that pipes the stream data back to the caller. 
            return new AssetFileDescriptor(
                    openPipeHelper(uri, mimeTypes[0], opts, c, this), 0,
                    AssetFileDescriptor.UNKNOWN_LENGTH);
        } 
 
        // If the MIME type is not supported, return a read-only handle to the file. 
        return super.openTypedAssetFile(uri, mimeTypeFilter, opts);
    } 
 
    /** 
     * Implementation of {@link android.content.ContentProvider.PipeDataWriter} 
     * to perform the actual work of converting the data in one of cursors to a 
     * stream of data for the client to read. 
     */ 
    @Override 
    public void writeDataToPipe(ParcelFileDescriptor output, Uri uri, String mimeType,