Java Code Examples for libcore.io.IoUtils#canOpenReadOnly()

The following examples show how to use libcore.io.IoUtils#canOpenReadOnly() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DexPathList.java    From AndroidComponentPlugin with Apache License 2.0 6 votes vote down vote up
public String findNativeLibrary(String name) {
    maybeInit();

    if (isDirectory) {
        String path = new File(dir, name).getPath();
        if (IoUtils.canOpenReadOnly(path)) {
            return path;
        }
    } else if (urlHandler != null) {
        // Having a urlHandler means the element has a zip file.
        // In this case Android supports loading the library iff
        // it is stored in the zip uncompressed.

        String entryName = new File(dir, name).getPath();
        if (urlHandler.isEntryStored(entryName)) {
          return zip.getPath() + zipSeparator + entryName;
        }
    }

    return null;
}
 
Example 2
Source File: DexPathList.java    From AndroidComponentPlugin with Apache License 2.0 6 votes vote down vote up
public String findNativeLibrary(String name) {
    maybeInit();

    if (zipDir == null) {
        String entryPath = new File(path, name).getPath();
        if (IoUtils.canOpenReadOnly(entryPath)) {
            return entryPath;
        }
    } else if (urlHandler != null) {
        // Having a urlHandler means the element has a zip file.
        // In this case Android supports loading the library iff
        // it is stored in the zip uncompressed.
        String entryName = zipDir + '/' + name;
        if (urlHandler.isEntryStored(entryName)) {
          return path.getPath() + zipSeparator + entryName;
        }
    }

    return null;
}
 
Example 3
Source File: DexPathList.java    From AndroidComponentPlugin with Apache License 2.0 6 votes vote down vote up
public String findNativeLibrary(String name) {
    maybeInit();

    if (isDirectory) {
        String path = new File(dir, name).getPath();
        if (IoUtils.canOpenReadOnly(path)) {
            return path;
        }
    } else if (zipFile != null) {
        String entryName = new File(dir, name).getPath();
        if (isZipEntryExistsAndStored(zipFile, entryName)) {
          return zip.getPath() + zipSeparator + entryName;
        }
    }

    return null;
}
 
Example 4
Source File: DexPathList.java    From AndroidComponentPlugin with Apache License 2.0 6 votes vote down vote up
public String findNativeLibrary(String name) {
    maybeInit();

    if (zipDir == null) {
        String entryPath = new File(path, name).getPath();
        if (IoUtils.canOpenReadOnly(entryPath)) {
            return entryPath;
        }
    } else if (urlHandler != null) {
        // Having a urlHandler means the element has a zip file.
        // In this case Android supports loading the library iff
        // it is stored in the zip uncompressed.
        String entryName = zipDir + '/' + name;
        if (urlHandler.isEntryStored(entryName)) {
          return path.getPath() + zipSeparator + entryName;
        }
    }

    return null;
}
 
Example 5
Source File: DexPathList.java    From AndroidComponentPlugin with Apache License 2.0 6 votes vote down vote up
public String findNativeLibrary(String name) {
    maybeInit();

    if (zipDir == null) {
        String entryPath = new File(path, name).getPath();
        if (IoUtils.canOpenReadOnly(entryPath)) {
            return entryPath;
        }
    } else if (urlHandler != null) {
        // Having a urlHandler means the element has a zip file.
        // In this case Android supports loading the library iff
        // it is stored in the zip uncompressed.
        String entryName = zipDir + '/' + name;
        if (urlHandler.isEntryStored(entryName)) {
          return path.getPath() + zipSeparator + entryName;
        }
    }

    return null;
}
 
Example 6
Source File: DexPathList.java    From AndroidComponentPlugin with Apache License 2.0 6 votes vote down vote up
public String findNativeLibrary(String name) {
    maybeInit();

    if (zipDir == null) {
        String entryPath = new File(path, name).getPath();
        if (IoUtils.canOpenReadOnly(entryPath)) {
            return entryPath;
        }
    } else if (urlHandler != null) {
        // Having a urlHandler means the element has a zip file.
        // In this case Android supports loading the library iff
        // it is stored in the zip uncompressed.
        String entryName = zipDir + '/' + name;
        if (urlHandler.isEntryStored(entryName)) {
          return path.getPath() + zipSeparator + entryName;
        }
    }

    return null;
}
 
Example 7
Source File: DexPathList.java    From AndroidComponentPlugin with Apache License 2.0 6 votes vote down vote up
public String findNativeLibrary(String name) {
    maybeInit();

    if (zipDir == null) {
        String entryPath = new File(path, name).getPath();
        if (IoUtils.canOpenReadOnly(entryPath)) {
            return entryPath;
        }
    } else if (urlHandler != null) {
        // Having a urlHandler means the element has a zip file.
        // In this case Android supports loading the library iff
        // it is stored in the zip uncompressed.
        String entryName = zipDir + '/' + name;
        if (urlHandler.isEntryStored(entryName)) {
          return path.getPath() + zipSeparator + entryName;
        }
    }

    return null;
}
 
Example 8
Source File: DexPathList.java    From AndroidComponentPlugin with Apache License 2.0 6 votes vote down vote up
public String findNativeLibrary(String name) {
    maybeInit();

    if (isDirectory) {
        String path = new File(dir, name).getPath();
        if (IoUtils.canOpenReadOnly(path)) {
            return path;
        }
    } else if (urlHandler != null) {
        // Having a urlHandler means the element has a zip file.
        // In this case Android supports loading the library iff
        // it is stored in the zip uncompressed.

        String entryName = new File(dir, name).getPath();
        if (urlHandler.isEntryStored(entryName)) {
          return zip.getPath() + zipSeparator + entryName;
        }
    }

    return null;
}
 
Example 9
Source File: DexPathList.java    From AndroidComponentPlugin with Apache License 2.0 5 votes vote down vote up
/**
 * Finds the named native code library on any of the library
 * directories pointed at by this instance. This will find the
 * one in the earliest listed directory, ignoring any that are not
 * readable regular files.
 *
 * @return the complete path to the library or {@code null} if no
 * library was found
 */
public String findLibrary(String libraryName) {
    String fileName = System.mapLibraryName(libraryName);
    for (File directory : nativeLibraryDirectories) {
        String path = new File(directory, fileName).getPath();
        if (IoUtils.canOpenReadOnly(path)) {
            return path;
        }
    }
    return null;
}
 
Example 10
Source File: DexPathList.java    From AndroidComponentPlugin with Apache License 2.0 5 votes vote down vote up
/**
 * Finds the named native code library on any of the library
 * directories pointed at by this instance. This will find the
 * one in the earliest listed directory, ignoring any that are not
 * readable regular files.
 *
 * @return the complete path to the library or {@code null} if no
 * library was found
 */
public String findLibrary(String libraryName) {
    String fileName = System.mapLibraryName(libraryName);
    for (File directory : nativeLibraryDirectories) {
        String path = new File(directory, fileName).getPath();
        if (IoUtils.canOpenReadOnly(path)) {
            return path;
        }
    }
    return null;
}
 
Example 11
Source File: DexPathList.java    From AndroidComponentPlugin with Apache License 2.0 5 votes vote down vote up
/**
 * Finds the named native code library on any of the library
 * directories pointed at by this instance. This will find the
 * one in the earliest listed directory, ignoring any that are not
 * readable regular files.
 *
 * @return the complete path to the library or {@code null} if no
 * library was found
 */
public String findLibrary(String libraryName) {
    String fileName = System.mapLibraryName(libraryName);
    for (File directory : nativeLibraryDirectories) {
        String path = new File(directory, fileName).getPath();
        if (IoUtils.canOpenReadOnly(path)) {
            return path;
        }
    }
    return null;
}
 
Example 12
Source File: DexPathList.java    From AndroidComponentPlugin with Apache License 2.0 5 votes vote down vote up
/**
 * Finds the named native code library on any of the library
 * directories pointed at by this instance. This will find the
 * one in the earliest listed directory, ignoring any that are not
 * readable regular files.
 *
 * @return the complete path to the library or {@code null} if no
 * library was found
 */
public String findLibrary(String libraryName) {
    String fileName = System.mapLibraryName(libraryName);
    for (File directory : nativeLibraryDirectories) {
        String path = new File(directory, fileName).getPath();
        if (IoUtils.canOpenReadOnly(path)) {
            return path;
        }
    }
    return null;
}