ch.cyberduck.core.Local.isFile()方法的使用及代码示例

x33g5p2x  于2022-01-24 转载在 其他  
字(5.6k)|赞(0)|评价(0)|浏览(126)

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

Local.isFile介绍

[英]This is only returning the correct result if the file already exists.
[中]这仅在文件已存在时返回正确的结果。

代码示例

代码示例来源:origin: iterate-ch/cyberduck

@Override
  public boolean accept(Local file) {
    if(file.isFile()) {
      return "fireFTPsites.dat".equals(file.getName());
    }
    return false;
  }
})) {

代码示例来源:origin: iterate-ch/cyberduck

@Override
  public boolean accept(final Path file, final Local local, final TransferStatus parent) throws BackgroundException {
    if(local.isFile()) {
      if(local.exists()) {
        if(log.isInfoEnabled()) {
          log.info(String.format("Skip file %s", file));
        }
        return false;
      }
    }
    return super.accept(file, local, parent);
  }
}

代码示例来源:origin: iterate-ch/cyberduck

@Override
  public int compare(final Local o1, final Local o2) {
    if(o1.isDirectory() && o2.isDirectory()) {
      return 0;
    }
    if(o1.isFile() && o2.isFile()) {
      return 0;
    }
    if(o1.isDirectory()) {
      return -1;
    }
    if(o2.isDirectory()) {
      return 1;
    }
    return 0;
  }
}

代码示例来源:origin: iterate-ch/cyberduck

/**
   * Skip files that already exist on the server.
   */
  @Override
  public boolean accept(final Path file, final Local local, final TransferStatus parent) throws BackgroundException {
    if(parent.isExists()) {
      if(local.isFile()) {
        if(find.withCache(cache).find(file)) {
          if(log.isInfoEnabled()) {
            log.info(String.format("Skip file %s", file));
          }
          return false;
        }
      }
    }
    return super.accept(file, local, parent);
  }
}

代码示例来源:origin: iterate-ch/cyberduck

@Override
public boolean accept(final Path file, final Local local, final TransferStatus parent) throws BackgroundException {
  if(super.accept(file, local, parent)) {
    if(local.isFile()) {
      if(parent.isExists()) {
        final Write.Append append = upload.append(file, local.attributes().getSize(), cache);

代码示例来源:origin: iterate-ch/cyberduck

@Override
public boolean accept(final Path file, final Local local, final TransferStatus parent) throws BackgroundException {
  if(local.isFile()) {
    if(local.exists()) {

代码示例来源:origin: iterate-ch/cyberduck

/**
 * @param file A valid bookmark dictionary
 * @return Null if the file cannot be deserialized
 * @throws AccessDeniedException If the file is not readable
 */
@Override
public S read(final Local file) throws AccessDeniedException {
  if(!file.exists()) {
    throw new LocalAccessDeniedException(file.getAbsolute());
  }
  if(!file.isFile()) {
    throw new LocalAccessDeniedException(file.getAbsolute());
  }
  final S deserialized = this.read(file.getInputStream());
  if(null == deserialized) {
    throw new AccessDeniedException(String.format("Failure parsing file %s", file.getName()));
  }
  return deserialized;
}

代码示例来源:origin: iterate-ch/cyberduck

/**
 * @param file A valid bookmark dictionary
 * @return Null if the file cannot be deserialized
 * @throws AccessDeniedException If the file is not readable
 */
@Override
public S read(final Local file) throws AccessDeniedException {
  if(!file.exists()) {
    throw new LocalAccessDeniedException(file.getAbsolute());
  }
  if(!file.isFile()) {
    throw new LocalAccessDeniedException(file.getAbsolute());
  }
  NSDictionary dict = NSDictionary.dictionaryWithContentsOfFile(file.getAbsolute());
  if(null == dict) {
    throw new AccessDeniedException(String.format("Failure parsing file %s", file.getName()));
  }
  return this.deserialize(dict);
}

代码示例来源:origin: iterate-ch/cyberduck

@Override
  public void run() {
    final NSOpenPanel panel = NSOpenPanel.openPanel();
    panel.setCanChooseDirectories(file.isDirectory());
    panel.setCanChooseFiles(file.isFile());
    panel.setAllowsMultipleSelection(false);
    panel.setMessage(MessageFormat.format(LocaleFactory.localizedString("Select {0}", "Credentials"),
      file.getAbbreviatedPath()));
    panel.setPrompt(LocaleFactory.localizedString("Choose"));
    final NSInteger modal = panel.runModal(file.getParent().getAbsolute(), file.getName());
    if(modal.intValue() == SheetCallback.DEFAULT_OPTION) {
      final NSArray filenames = panel.filenames();
      final NSEnumerator enumerator = filenames.objectEnumerator();
      NSObject next;
      while((next = enumerator.nextObject()) != null) {
        selected.set(new FinderLocal(next.toString()));
      }
    }
    panel.orderOut(null);
  }
};

代码示例来源:origin: iterate-ch/cyberduck

if(local.isFile()) {
  if(local.attributes().getSize() == 0) {

代码示例来源:origin: iterate-ch/cyberduck

if(local.isFile()) {
  throw new LocalAccessDeniedException(String.format("Cannot replace file %s with folder %s", local.getAbbreviatedPath(), file.getName()));

代码示例来源:origin: iterate-ch/cyberduck

if(local.isFile()) {
  if(local.exists()) {
    if(local.attributes().getSize() > 0) {

代码示例来源:origin: iterate-ch/cyberduck

if(local.isFile()) {
  if(local.isFile()) {
    final Redundancy feature = session.getFeature(Redundancy.class);
    if(feature != null) {
  if(local.isFile()) {
    final ChecksumCompute feature = session.getFeature(Write.class).checksum(file);
    if(feature != null) {

代码示例来源:origin: iterate-ch/cyberduck

@Override
  public Acl getDefault(final Local file) {
    final Permission permission;
    if(PreferencesFactory.get().getBoolean("queue.upload.permissions.default")) {
      if(file.isFile()) {
        permission = new Permission(
            PreferencesFactory.get().getInteger("queue.upload.permissions.file.default"));
      }
      else {
        permission = new Permission(
            PreferencesFactory.get().getInteger("queue.upload.permissions.folder.default"));
      }
    }
    else {
      // Read permissions from local file
      permission = file.attributes().getPermission();
    }
    final Acl acl = new Acl();
    if(permission.getOther().implies(Permission.Action.read)) {
      acl.addAll(new Acl.GroupUser(Acl.GroupUser.EVERYONE), new Acl.Role(Acl.Role.READ));
    }
    if(permission.getGroup().implies(Permission.Action.read)) {
      acl.addAll(new Acl.GroupUser(Acl.GroupUser.AUTHENTICATED), new Acl.Role(Acl.Role.READ));
    }
    if(permission.getGroup().implies(Permission.Action.write)) {
      acl.addAll(new Acl.GroupUser(Acl.GroupUser.AUTHENTICATED), new Acl.Role(Acl.Role.WRITE));
    }
    return acl;
  }
}

相关文章