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

x33g5p2x  于2022-01-26 转载在 其他  
字(6.7k)|赞(0)|评价(0)|浏览(203)

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

Path.getName介绍

暂无

代码示例

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

@Override
  protected int compareFirst(final Path p1, final Path p2) {
    if(ascending) {
      return impl.compare(p1.getName(), p2.getName());
    }
    return -impl.compare(p1.getName(), p2.getName());
  }
}

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

protected String toString(final List<Path> files) {
  final StringBuilder name = new StringBuilder();
  name.append(files.get(0).getName());
  if(files.size() > 1) {
    name.append("…");
  }
  return name.toString();
}

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

@Override
  public String getActivity() {
    return MessageFormat.format(LocaleFactory.localizedString("Uploading {0}", "Status"), link.getName());
  }
}

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

@Override
public String getActivity() {
  return MessageFormat.format(LocaleFactory.localizedString("Uploading {0}", "Status"),
    file.getName());
}

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

@Override
public String getActivity() {
  return MessageFormat.format(LocaleFactory.localizedString("Making directory {0}", "Status"),
    folder.getName());
}

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

protected String toString(final List<Path> files) {
  if(files.isEmpty()) {
    return LocaleFactory.localizedString("None");
  }
  final String name = files.get(0).getName();
  if(files.size() > 1) {
    return String.format("%s… (%s) (%d)", name, LocaleFactory.localizedString("Multiple files"), files.size());
  }
  return String.format("%s…", name);
}

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

@Override
  protected String query(final Path directory, final ListProgressListener listener) throws BackgroundException {
    // Surround with single quotes '. Escape single quotes in queries with \', e.g., 'Valentine\'s Day'.
    String escaped = file.getName();
    escaped = StringUtils.replace(escaped, "\\", "\\\\");
    escaped = StringUtils.replace(escaped, "'", "\\'");
    return String.format("name = '%s' and '%s' in parents", escaped, provider.getFileid(directory, new DisabledListProgressListener()));
  }
}

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

@Override
public String getActivity() {
  return MessageFormat.format(LocaleFactory.localizedString("Downloading {0}", "Status"),
      editor.getRemote().getName());
}

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

@Override
public NSView getAccessoryView(final NSAlert alert) {
  final NSView view = super.getAccessoryView(alert);
  this.updateField(inputField, FilenameUtils.getBaseName(selected.getName()));
  return view;
}

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

@Override
  public void delete(final Path file) {
    listener.message(MessageFormat.format(LocaleFactory.localizedString("Deleting {0}", "Status"),
      file.getName()));
  }
}, callback)

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

/**
 * @param files Files to archive
 * @return Name of archive
 */
public String getTitle(final List<Path> files) {
  final Path archive = this.getArchive(files);
  if(null == archive) {
    return this.getIdentifier();
  }
  return archive.getName();
}

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

/**
 * Create random prefix for filename
 *
 * @param file Filename
 */
@Override
public Local create(final Path file) {
  return this.create(String.format("%s-%s", new AlphanumericRandomStringService().random(), file.getName()));
}

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

@Override
public Algorithm getEncryption(final Path file) throws BackgroundException {
  if(containerService.isContainer(file)) {
    final String key = String.format("s3.encryption.key.%s", containerService.getContainer(file).getName());
    if(StringUtils.isNotBlank(preferences.getProperty(key))) {
      return Algorithm.fromString(preferences.getProperty(key));
    }
  }
  return super.getEncryption(file);
}

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

private Path inflate(final Session<?> session, final Path file) throws BackgroundException {
  final String fileName = file.getName();
  if(filenameProvider.isDeflated(fileName)) {
    final String filename = filenameProvider.inflate(session, fileName);
    return new Path(file.getParent(), filename, EnumSet.of(Path.Type.file), file.attributes());
  }
  return file;
}

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

@Override
public String getKind(final Path file) {
  if(file.isFile()) {
    return this.getKind(file.getName());
  }
  if(file.isDirectory()) {
    return LocaleFactory.localizedString("Folder");
  }
  return LocaleFactory.localizedString("Unknown");
}

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

@Override
  public NSObject comboBox_objectValueForItemAtIndex(final NSComboBox sender, final NSInteger row) {
    return NSString.stringWithString(cache.get(workdir)
        .filter(comparator, filter).get(row.intValue()).getName());
  }
}

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

protected void write(final Session<?> session, final UnixPermission feature, final Path file, final Permission permission) throws BackgroundException {
  listener.message(MessageFormat.format(LocaleFactory.localizedString("Changing permission of {0} to {1}", "Status"),
    file.getName(), permission));
  feature.setUnixPermission(file, permission);
  if(file.isDirectory()) {
    if(callback.recurse(file, permission)) {
      for(Path child : session.getFeature(ListService.class).list(file, new WorkerListProgressListener(this, listener))) {
        this.write(session, feature, child, permission);
      }
    }
  }
}

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

@Override
public Path touch(final Path file, final TransferStatus status) throws BackgroundException {
  if(Checksum.NONE == status.getChecksum()) {
    status.setChecksum(writer.checksum(file).compute(new NullInputStream(0L), status));
  }
  status.setTimestamp(System.currentTimeMillis());
  final StatusOutputStream<BaseB2Response> out = writer.write(file, status, new DisabledConnectionCallback());
  new DefaultStreamCloser().close(out);
  return new Path(file.getParent(), file.getName(), file.getType(),
    new B2AttributesFinderFeature(session, fileid).toAttributes((B2FileResponse) out.getStatus()));
}

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

@Override
public Path touch(final Path file, final TransferStatus status) throws BackgroundException {
  status.setLength(0L);
  final StatusOutputStream<StorageObject> out = writer.write(file, status, new DisabledConnectionCallback());
  new DefaultStreamCloser().close(out);
  final StorageObject metadata = out.getStatus();
  return new Path(file.getParent(), file.getName(), file.getType(),
    new SwiftAttributesFinderFeature(session, regionService).toAttributes(metadata));
}

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

@Override
public Path mkdir(final Path folder, final String region, final TransferStatus status) throws BackgroundException {
  try {
    final CreateFolderResult result = new DbxUserFilesRequests(session.getClient()).createFolderV2(folder.getAbsolute(), false);
    return new Path(folder.getParent(), folder.getName(), folder.getType(),
      new DropboxAttributesFinderFeature(session).toAttributes(result.getMetadata()));
  }
  catch(DbxException e) {
    throw new DropboxExceptionMappingService().map(e);
  }
}

相关文章