resources/src/main/java/org/robolectric/res/android/Asset.java
static Asset createFromFile(final String fileName, AccessMode mode)
  {
    File file = new File(fileName);
    if (!file.exists()) {
      return null;
    }
    throw new UnsupportedOperationException();

    // _FileAsset pAsset;
    // int result;
    // long length;
    // int fd;
    //
    //   fd = open(fileName, O_RDONLY | O_BINARY);
    //   if (fd < 0)
    //     return null;
    //
    //   /*
    //    * Under Linux, the lseek fails if we actually opened a directory.  To
    //    * be correct we should test the file type explicitly, but since we
    //    * always open things read-only it doesn't really matter, so there's
    //    * no value in incurring the extra overhead of an fstat() call.
    //    */
    //   // TODO(kroot): replace this with fstat despite the plea above.
    //   #if 1
    //   length = lseek64(fd, 0, SEEK_END);
    //   if (length < 0) {
    //   ::close(fd);
    //     return null;
    //   }
    //   (void) lseek64(fd, 0, SEEK_SET);
    //   #else
    //   struct stat st;
    //   if (fstat(fd, &st) < 0) {
    //   ::close(fd);
    //   return null;
    // }
    //
    //   if (!S_ISREG(st.st_mode)) {
    //   ::close(fd);
    //     return null;
    //   }
    //   #endif
    //
    //     pAsset = new _FileAsset;
    //   result = pAsset.openChunk(fileName, fd, 0, length);
    //   if (result != NO_ERROR) {
    //     delete pAsset;
    //     return null;
    //   }
    //
    //   pAsset.mAccessMode = mode;
    //   return pAsset;
  }
static Asset createFromFile(final String fileName, AccessMode mode)
  {
    File file = new File(fileName);
    if (!file.exists()) {
      return null;
    }
    throw new UnsupportedOperationException();

    // _FileAsset pAsset;
    // int result;
    // long length;
    // int fd;
    //
    //   fd = open(fileName, O_RDONLY | O_BINARY);
    //   if (fd < 0)
    //     return null;
    //
    //   /*
    //    * Under Linux, the lseek fails if we actually opened a directory.  To
    //    * be correct we should test the file type explicitly, but since we
    //    * always open things read-only it doesn't really matter, so there's
    //    * no value in incurring the extra overhead of an fstat() call.
    //    */
    //   // TODO(kroot): replace this with fstat despite the plea above.
    //   #if 1
    //   length = lseek64(fd, 0, SEEK_END);
    //   if (length < 0) {
    //   ::close(fd);
    //     return null;
    //   }
    //   (void) lseek64(fd, 0, SEEK_SET);
    //   #else
    //   struct stat st;
    //   if (fstat(fd, &st) < 0) {
    //   ::close(fd);
    //   return null;
    // }
    //
    //   if (!S_ISREG(st.st_mode)) {
    //   ::close(fd);
    //     return null;
    //   }
    //   #endif
    //
    //     pAsset = new _FileAsset;
    //   result = pAsset.openChunk(fileName, fd, 0, length);
    //   if (result != NO_ERROR) {
    //     delete pAsset;
    //     return null;
    //   }
    //
    //   pAsset.mAccessMode = mode;
    //   return pAsset;
  }
static Asset createFromFile ( final String fileName , AccessMode mode ) { File file = new File ( fileName ) ; if ( ! file . exists ( ) ) { return null ; } throw new UnsupportedOperationException ( ) ; // _FileAsset pAsset; // int result; // long length; // int fd; // //   fd = open(fileName, O_RDONLY | O_BINARY); //   if (fd < 0) //     return null; // //   /* //    * Under Linux, the lseek fails if we actually opened a directory.  To //    * be correct we should test the file type explicitly, but since we //    * always open things read-only it doesn't really matter, so there's //    * no value in incurring the extra overhead of an fstat() call. //    */ //   // TODO(kroot): replace this with fstat despite the plea above. //   #if 1 //   length = lseek64(fd, 0, SEEK_END); //   if (length < 0) { //   ::close(fd); //     return null; //   } //   (void) lseek64(fd, 0, SEEK_SET); //   #else //   struct stat st; //   if (fstat(fd, &st) < 0) { //   ::close(fd); //   return null; // } // //   if (!S_ISREG(st.st_mode)) { //   ::close(fd); //     return null; //   } //   #endif // //     pAsset = new _FileAsset; //   result = pAsset.openChunk(fileName, fd, 0, length); //   if (result != NO_ERROR) { //     delete pAsset; //     return null; //   } // //   pAsset.mAccessMode = mode; //   return pAsset; }
/*
Create a new Asset from a file on disk.  There is a fair chance that
the file doesn't actually exist.

We can use "mode" to decide how we want to go about it.
/ * Create a new Asset from a file on disk . There is a fair chance that the file doesn t actually exist .