Code example for ParcelFileDescriptor

Methods: getFileDescriptor

0
        } 
 
        String getContents() throws Exception {
            ParcelFileDescriptor downloadedFile = mManager.openDownloadedFile(mId);
            assertTrue("Invalid file descriptor: " + downloadedFile,
                       downloadedFile.getFileDescriptor().valid());
            final InputStream stream = new ParcelFileDescriptor.AutoCloseInputStream(
                    downloadedFile);
            try { 
                return readStream(stream);
            } finally { 
                stream.close();
            } 
        } 
 
        void runUntilStatus(int status) throws TimeoutException {
            final long startMillis = mSystemFacade.currentTimeMillis();
            startService(null); 
            waitForStatus(status, startMillis);
        }