/** * Helper operation used to remove relative path notation from * resources. Most critical for resources on the Classpath * as resource loaders will not resolve the relative paths correctly. * * @param name the name of the resource to load * @return the modified or unmodified string if there were no changes */ private static String resolveUriPath(String name) { // compact the path and use / as separator as that's used for loading resources on the classpath return FileUtil.compactPath(name, '/'); }
public synchronized void changeToParentDirectory() throws GenericFileOperationFailedException { LOG.trace("changeToParentDirectory()"); String current = getCurrentDirectory(); String parent = FileUtil.compactPath(current + "/.."); // must start with absolute if (!parent.startsWith("/")) { parent = "/" + parent; } changeCurrentDirectory(parent); }
public URL loadResourceAsURL(String uri) { IllegalArgumentAssertion.assertNotNull(uri, "uri"); String resolvedName = FileUtil.compactPath(uri, '/'); return classLoader.getResource(resolvedName); }
public InputStream loadResourceAsStream(String uri) { IllegalArgumentAssertion.assertNotNull(uri, "uri"); String resolvedName = FileUtil.compactPath(uri, '/'); return classLoader.getResourceAsStream(resolvedName); }
public URL loadResourceAsURL(String uri) { IllegalArgumentAssertion.assertNotNull(uri, "uri"); String resolvedName = FileUtil.compactPath(uri, '/'); return classLoader.getResource(resolvedName); }
public InputStream loadResourceAsStream(String uri) { IllegalArgumentAssertion.assertNotNull(uri, "uri"); String resolvedName = FileUtil.compactPath(uri, '/'); return classLoader.getResourceAsStream(resolvedName); }
public synchronized boolean renameFile(String from, String to) throws GenericFileOperationFailedException { LOG.debug("Renaming file: {} to: {}", from, to); try { reconnectIfNecessary(); // make use of the '/' separator because JSch expects this // as the file separator even on Windows to = FileUtil.compactPath(to, '/'); channel.rename(from, to); return true; } catch (SftpException e) { LOG.debug("Cannot rename file from: " + from + " to: " + to, e); throw new GenericFileOperationFailedException("Cannot rename file from: " + from + " to: " + to, e); } }
path = FileUtil.compactPath(path, separatorChar); if (LOG.isTraceEnabled()) { LOG.trace("Compacted path: {} -> {} using separator: {}", before, path, separatorChar);