@Override public int compare(MetaInfResource one, MetaInfResource two) { Resource res1 = LocationUtils.getResource(one.getLocation()); Resource res2 = LocationUtils.getResource(two.getLocation()); String filename1 = res1.getFilename(); String filename2 = res2.getFilename(); return filename1.compareTo(filename2); }
/** * Open an <code>InputStream</code> to <code>location</code>. If <code>location</code> is the path to an existing <code>File</code> on the local file system, a * <code>FileInputStream</code> is returned. Otherwise Spring's resource loading framework is used to open an <code>InputStream</code> to <code>location</code>. */ public static final InputStream getInputStream(String location) throws IOException { if (isExistingFile(location)) { return FileUtils.openInputStream(new File(location)); } Resource resource = getResource(location); return resource.getInputStream(); }
/** * Null safe method for determining if <code>location</code> exists. */ public static final boolean exists(String location) { if (location == null) { return false; } if (isExistingFile(location)) { return true; } else { Resource resource = getResource(location); return resource.exists(); } }
public static final String getFilename(String location) { if (location == null) { return null; } if (isExistingFile(location)) { return getFileQuietly(location).getName(); } else { Resource resource = getResource(location); return resource.getFilename(); } }
/** * Null safe method for determining if <code>location</code> exists. */ public static final boolean exists(File file) { if (file == null) { return false; } String location = getCanonicalPath(file); if (isExistingFile(location)) { return true; } else { Resource resource = getResource(location); return resource.exists(); } }