protected void verifyFileContents(ParcelFileDescriptor pfd,File file) throws IOException {
  byte[] actual=new byte[FILE_BLOCK_READ_SIZE];
  byte[] expected=new byte[FILE_BLOCK_READ_SIZE];
  AutoCloseInputStream input=new ParcelFileDescriptor.AutoCloseInputStream(pfd);
  assertEquals(file.length(),pfd.getStatSize());
  DataInputStream inFile=new DataInputStream(new FileInputStream(file));
  int actualRead=0;
  int expectedRead=0;
  while (((actualRead=input.read(actual)) != -1) && ((expectedRead=inFile.read(expected)) != -1)) {
    assertEquals(actualRead,expectedRead);
    compareByteArrays(actual,expected);
  }
}

protected void verifyFileContents ( ParcelFileDescriptor pfd , File file ) throws IOException { byte [ ] actual = new byte [ FILE_BLOCK_READ_SIZE ] ; byte [ ] expected = new byte [ FILE_BLOCK_READ_SIZE ] ; AutoCloseInputStream input = new ParcelFileDescriptor . AutoCloseInputStream ( pfd ) ; assertEquals ( file . length ( ) , pfd . getStatSize ( ) ) ; DataInputStream inFile = new DataInputStream ( new FileInputStream ( file ) ) ; int actualRead = 0 ; int expectedRead = 0 ; while ( ( ( actualRead = input . read ( actual ) ) != - 1 ) && ( ( expectedRead = inFile . read ( expected ) ) != - 1 ) ) { assertEquals ( actualRead , expectedRead ) ; compareByteArrays ( actual , expected ) ; } }
verifies the contents of a downloaded file versus the contents of a file .
