Java Code Examples for mil.nga.geopackage.io.GeoPackageIOUtils#getFileExtension()
The following examples show how to use
mil.nga.geopackage.io.GeoPackageIOUtils#getFileExtension() .
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: CacheUtils.java From mage-android with Apache License 2.0 | 5 votes |
/** * Copy the Uri to the cache directory in a background task * * @param context * @param uri * @param path bn */ public static void copyToCache(Context context, Uri uri, String path) { // Get a cache directory to write to File cacheDirectory = CacheUtils.getApplicationCacheDirectory(context); if (cacheDirectory != null) { // Get the Uri display name, which should be the file name with extension String name = MediaUtility.getDisplayName(context, uri, path); // If no extension, add a GeoPackage extension if(GeoPackageIOUtils.getFileExtension(new File(name)) == null){ name += "." + GeoPackageConstants.GEOPACKAGE_EXTENSION; } // Verify that the file is a cache file by its extension File cacheFile = new File(cacheDirectory, name); if (isCacheFile(cacheFile)) { if(cacheFile.exists()) { cacheFile.delete(); } String cacheName = MediaUtility.getFileNameWithoutExtension(cacheFile); CacheProvider.getInstance(context).removeCacheOverlay(cacheName); // Copy the file in a background task CopyCacheStreamTask task = new CopyCacheStreamTask(context, uri, cacheFile, cacheName); task.execute(); } } }
Example 2
Source File: GeoPackageValidate.java From geopackage-core-java with MIT License | 2 votes |
/** * Check the file extension to see if it is a GeoPackage * * @param file * GeoPackage file * @return true if GeoPackage extension */ public static boolean hasGeoPackageExtension(File file) { String extension = GeoPackageIOUtils.getFileExtension(file); return isGeoPackageExtension(extension); }
Example 3
Source File: GeoPackageValidate.java From geopackage-core-java with MIT License | 2 votes |
/** * Check the file name extension to see if it is a GeoPackage * * @param name * GeoPackage file name * @return true if GeoPackage extension * @since 3.5.0 */ public static boolean hasGeoPackageExtension(String name) { String extension = GeoPackageIOUtils.getFileExtension(name); return isGeoPackageExtension(extension); }