Here you can find the source of getCanonicalFile(File inFile)
Parameter | Description |
---|---|
inFile | a parameter |
public static File getCanonicalFile(File inFile)
//package com.java2s; //License from project: Open Source License import java.io.File; import java.io.IOException; public class Main { public static File getCanonicalFile(String inPath) { return getCanonicalFile(inPath, false); }//from w w w . ja v a 2s. c om public static File getCanonicalFile(String inPath, boolean inThrowRuntimeException) { return isBlank(inPath) ? null : getCanonicalFile(new File(inPath), inThrowRuntimeException); } /** * Will return absolute file if not possible to determine the canonical file. * * Same as <code>getCanonicalFile(File inFile, boolean inThrowRuntimeException)</code> but parameter <code>inThrowRuntimeException</code> is set to <code>false</code> * @param inFile * @return */ public static File getCanonicalFile(File inFile) { return getCanonicalFile(inFile, false); } public static File getCanonicalFile(File inFile, boolean inThrowRuntimeException) { try { return inFile == null ? null : inFile.getCanonicalFile(); } catch (final IOException e) { if (inThrowRuntimeException) { throw new RuntimeException(inFile == null ? "File is null" : e.getMessage(), e); } return inFile.getAbsoluteFile(); } } public static boolean isBlank(String inValue) { return inValue == null || inValue.trim().isEmpty(); } }