Lines Matching refs:file

5  * you may not use this file except in compliance with the License.
86 // Just a few popular file types used to return from a download
334 * Helper to verify the size of a file.
336 * @param pfd The input file to compare the size of
337 * @param size The expected size of the file
344 * Helper to verify the contents of a downloaded file versus a byte[].
346 * @param actual The file of whose contents to verify
347 * @param expected The data we expect to find in the aforementioned file
348 * @throws IOException if there was a problem reading from the file
381 * Verifies the contents of a downloaded file versus the contents of a File.
383 * @param pfd The file whose data we want to verify
384 * @param file The file containing the data we expect to see in the aforementioned file
387 protected void verifyFileContents(ParcelFileDescriptor pfd, File file) throws IOException {
393 assertEquals(file.length(), pfd.getStatSize());
395 DataInputStream inFile = new DataInputStream(new FileInputStream(file));
407 * Sets the MIME type of file that will be served from the mock server
440 * @param filename The name of the file to try to retrieve from the mock server
441 * @return the Uri to use for access the file on the mock server
451 * @param filename The name of the file to try to retrieve from the mock server
452 * @return the Uri to use for access the file on the mock server
476 * Helper to verify a standard single-file download from the mock server, and clean up after
479 * Note that this also calls the Download manager's remove, which cleans up the file from cache.
482 * @param fileData The data to verify the file contains
580 * Helper to create a large file of random data on the SD card.
582 * @param filename (optional) The name of the file to create on the SD card; pass in null to
584 * @param type The type of file to create
585 * @param subdirectory If not null, the subdirectory under the SD card where the file should go
587 * @throws IOException if there was an error while creating the file.
592 // Build up the file path and name
599 File file = null;
601 file = File.createTempFile("DMTEST_", null, new File(fullPath.toString()));
605 file = new File(fullPath.toString());
606 file.createNewFile();
609 // Fill the file with random data
610 DataOutputStream output = new DataOutputStream(new FileOutputStream(file));
630 Log.i(TAG, "while creating " + fileSize + " file, " +
634 Log.e(LOG_TAG, "Error writing to file " + file.getAbsolutePath());
635 file.delete();
640 return file;
856 * Synchronously waits for a file to increase in size (such as to monitor that a download is
859 * @param file The file whose size to track.
860 * @throws Exception if timed out while waiting for the file to grow in size.
862 protected void waitForFileToGrow(File file) throws Exception {
866 while (!file.exists()) {
867 Log.i(LOG_TAG, "Waiting for file to exist...");
869 MAX_WAIT_FOR_DOWNLOAD_TIME, "Timed out waiting for file to be created.");
872 // Get original file size...
873 long originalSize = file.length();
875 while (file.length() <= originalSize) {
876 Log.i(LOG_TAG, "Waiting for file to be written to...");
878 MAX_WAIT_FOR_DOWNLOAD_TIME, "Timed out waiting for file to be written to.");
935 * @param body The body to return in the response from the server, contained in the file