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

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

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

FileUtil.onlyPath介绍

暂无

代码示例

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

@Override
public Enumeration<URL> loadAllResourcesAsURL(String uri) {
  ObjectHelper.notEmpty(uri, "uri");
  Vector<URL> answer = new Vector<>();
  try {
    String resolvedName = resolveUriPath(uri);
    Enumeration<URL> e = bundleContext.getBundle().getResources(resolvedName);
    while (e != null && e.hasMoreElements()) {
      answer.add(e.nextElement());
    }
    String path = FileUtil.onlyPath(uri);
    String name = FileUtil.stripPath(uri);
    if (path != null && name != null) {
      for (Bundle bundle : bundleContext.getBundles()) {
        LOG.trace("Finding all entries in path: {} with pattern: {}", path, name);
        e = bundle.findEntries(path, name, false);
        while (e != null && e.hasMoreElements()) {
          answer.add(e.nextElement());
        }
      }
    }
  } catch (IOException e) {
    throw new RuntimeException("Cannot load resource: " + uri, e);
  }
  return answer.elements();
}

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

String directory = FileUtil.onlyPath(name);
if (directory == null) {

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

String directory = FileUtil.onlyPath(name);
String onlyName = FileUtil.stripPath(name);
try {

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

String dir = FileUtil.onlyPath(to);
if (dir != null) {

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

String path = FileUtil.onlyPath(name);
if (path != null) {
  changeCurrentDirectory(path);

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

public boolean deleteFile(String name) throws GenericFileOperationFailedException {
  log.debug("Deleting file: {}", name);
  boolean result;
  String target = name;
  String currentDir = null;
  try {
    if (endpoint.getConfiguration().isStepwise()) {
      // remember current directory
      currentDir = getCurrentDirectory();
      target = FileUtil.stripPath(name);
      try {
        changeCurrentDirectory(FileUtil.onlyPath(name));
      } catch (GenericFileOperationFailedException e) {
        // we could not change directory, try to change back before
        changeCurrentDirectory(currentDir);
        throw e;
      }
    }
    // delete the file
    log.trace("Client deleteFile: {}", target);
    result = client.deleteFile(target);
    // change back to previous directory
    if (currentDir != null) {
      changeCurrentDirectory(currentDir);
    }
  } catch (IOException e) {
    throw new GenericFileOperationFailedException(client.getReplyCode(), client.getReplyString(), e.getMessage(), e);
  }
  return result;
}

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

String path = FileUtil.onlyPath(name);
if (path != null) {
  changeCurrentDirectory(path);

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

String path = FileUtil.onlyPath(name);
if (path != null) {
  changeCurrentDirectory(path);

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

public synchronized boolean storeFile(String name, Exchange exchange, long size) throws GenericFileOperationFailedException {
  // must normalize name first
  name = endpoint.getConfiguration().normalizePath(name);
  LOG.trace("storeFile({})", name);
  boolean answer = false;
  String currentDir = null;
  String path = FileUtil.onlyPath(name);
  String targetName = name;
  try {
    if (path != null && endpoint.getConfiguration().isStepwise()) {
      // must remember current dir so we stay in that directory after
      // the write
      currentDir = getCurrentDirectory();
      // change to path of name
      changeCurrentDirectory(path);
      // the target name should be without path, as we have changed
      // directory
      targetName = FileUtil.stripPath(name);
    }
    // store the file
    answer = doStoreFile(name, targetName, exchange);
  } finally {
    // change back to current directory if we changed directory
    if (currentDir != null) {
      changeCurrentDirectory(currentDir);
    }
  }
  return answer;
}

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

String dir = FileUtil.onlyPath(to);
if (dir != null) {

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

String path = FileUtil.onlyPath(name);
if (path != null) {
  changeCurrentDirectory(path);

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

String path = FileUtil.onlyPath(name);
String targetName = name;

相关文章