org.apache.camel.util.FileUtil.compactPath()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(2.9k)|赞(0)|评价(0)|浏览(112)

本文整理了Java中org.apache.camel.util.FileUtil.compactPath()方法的一些代码示例,展示了FileUtil.compactPath()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。FileUtil.compactPath()方法的具体详情如下:
包路径:org.apache.camel.util.FileUtil
类名称:FileUtil
方法名:compactPath

FileUtil.compactPath介绍

暂无

代码示例

代码示例来源:origin: org.apache.camel/camel-core-osgi

/**
 * 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, '/');
}

代码示例来源:origin: org.apache.camel/camel-ftp

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);
}

代码示例来源:origin: org.wildfly.camel/wildfly-camel-subsystem-core

public URL loadResourceAsURL(String uri) {
  IllegalArgumentAssertion.assertNotNull(uri, "uri");
  String resolvedName = FileUtil.compactPath(uri, '/');
  return classLoader.getResource(resolvedName);
}

代码示例来源:origin: org.wildfly.camel/wildfly-camel-subsystem-core

public InputStream loadResourceAsStream(String uri) {
  IllegalArgumentAssertion.assertNotNull(uri, "uri");
  String resolvedName = FileUtil.compactPath(uri, '/');
  return classLoader.getResourceAsStream(resolvedName);
}

代码示例来源:origin: wildfly-extras/wildfly-camel

public URL loadResourceAsURL(String uri) {
  IllegalArgumentAssertion.assertNotNull(uri, "uri");
  String resolvedName = FileUtil.compactPath(uri, '/');
  return classLoader.getResource(resolvedName);
}

代码示例来源:origin: wildfly-extras/wildfly-camel

public InputStream loadResourceAsStream(String uri) {
  IllegalArgumentAssertion.assertNotNull(uri, "uri");
  String resolvedName = FileUtil.compactPath(uri, '/');
  return classLoader.getResourceAsStream(resolvedName);
}

代码示例来源:origin: org.apache.camel/camel-ftp

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);
  }
}

代码示例来源:origin: org.apache.camel/camel-ftp

path = FileUtil.compactPath(path, separatorChar);
if (LOG.isTraceEnabled()) {
  LOG.trace("Compacted path: {} -> {} using separator: {}", before, path, separatorChar);

相关文章