Code example for File

Methods: exists, toString

0
			return new File(new File(Environment.getDataDirectory(), "data"), getPackageName(someKnownResource));
	} 
     
    @Override 
    public synchronized NativeLibrary loadNativeLibrary(String name) throws IOException {
        File f = new File(getNativeLibraryDir(name), getLibFileName(name));
        if (f.exists()) {
            return NativeLibrary.load(f == null ? name : f.toString());
        } else { 
            throw new RuntimeException("File not found : " + f);
        } 
    } 
     
    synchronized String getPackageName(String someKnownResource) throws FileNotFoundException {
        if (app != null)
            return app.getPackageName();
        else { 
            URL resource = Platform.getResource(someKnownResource);
            if (resource == null)
                throw new FileNotFoundException("Resource does not exist : " + someKnownResource);