List of usage examples for java.io File getCanonicalPath
public String getCanonicalPath() throws IOException
From source file:Main.java
public static String getAbsPath(File file) { String path = null;//from w ww.j av a2s .c o m try { path = file.getCanonicalPath(); } catch (IOException e) { path = file.getAbsolutePath(); Log.i("[explorer():]", e.toString()); } return path; }
From source file:Main.java
public static int getOrientationFromExif(File imgFile) throws IOException { ExifInterface exif = new ExifInterface(imgFile.getCanonicalPath()); return exif.getAttributeInt(ExifInterface.TAG_ORIENTATION, ExifInterface.ORIENTATION_UNDEFINED); }
From source file:Main.java
public static String getCanonical(File f) { if (f == null) return null; try {/* w w w . j av a2 s. c o m*/ return f.getCanonicalPath(); } catch (IOException e) { return f.getAbsolutePath(); } }
From source file:Main.java
/** * This method gives you the bitmap of the image you tell it to load from the filesystem. * @param uri The file location./*from www.j av a2 s. c o m*/ * @return The bitmap of the photo at the location you specify. */ public static Bitmap getImageBitmap(String uri) { final File f = new File(uri); try { return getImage(f.getCanonicalPath()); } catch (IOException e) { Log.e(TAG, "Error loading image for loading", e); return null; } }
From source file:com.igitras.codegen.common.utils.Utils.java
public static String toCanonicalPath(File file) { try {/*from ww w . jav a2 s . c om*/ return file.getCanonicalPath(); } catch (IOException e) { return null; } }
From source file:com.liferay.cucumber.util.FileUtil.java
public static String getCanonicalPath(String dir) { try {/*from ww w .j a v a2 s . co m*/ File file = new File(dir); return file.getCanonicalPath(); } catch (IOException ioe) { ioe.printStackTrace(); } return dir; }
From source file:Main.java
public static Date getExifDate(File imgFile) throws IOException { ExifInterface imgFileExif = new ExifInterface(imgFile.getCanonicalPath()); if (imgFileExif.getAttribute(ExifInterface.TAG_DATETIME) != null) { String imgDateTime = imgFileExif.getAttribute(ExifInterface.TAG_DATETIME); SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy:MM:dd HH:mm:ss", Locale.US); try {/*from w w w . j a v a2 s . co m*/ return simpleDateFormat.parse(imgDateTime); } catch (ParseException e) { e.printStackTrace(); } } return null; }
From source file:name.martingeisse.ecobuild.util.EcobuildFileUtil.java
/** * Like file.getCanonicalPath(), but wraps {@link IOException} in {@link FatalBuildException}. * @param file the file to get the canonical path from * @return the canonical path/*ww w .j a v a 2 s . c o m*/ */ public static String getCanonicalPath(File file) { try { return file.getCanonicalPath(); } catch (IOException e) { throw new FatalBuildException("File.getCanonicalPath() failed", e); } }
From source file:biz.gabrys.maven.plugin.util.io.RegexFileFilter.java
/** * Returns canonical path for a file.//from www . ja v a 2 s. c om * @param file the file. * @return file canonical path. * @throws RegexFileFilterException if an error occurs while resolving canonical path. * @since 1.2 */ protected static String getCanonicalPath(final File file) { try { return file.getCanonicalPath(); } catch (final IOException e) { throw new RegexFileFilterException(e); } }
From source file:Main.java
public static String getBitmapStoragePath(Context context) { String bitmapStoragePath = ""; if (Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) { try {//from w ww . java2s.c om String root = context.getExternalFilesDir(null).getCanonicalPath(); if (null != root) { File bitmapStorageDir = new File(root, APP_DIR); bitmapStorageDir.mkdirs(); bitmapStoragePath = bitmapStorageDir.getCanonicalPath(); } } catch (IOException e) { e.printStackTrace(); } } return bitmapStoragePath; }