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

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

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

Path.<init>介绍

暂无

代码示例

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

public Path resolve(final String filename) {
  // Intermediate directory
  final Path first = new Path(metadataRoot, filename.substring(0, 2), metadataRoot.getType());
  // Intermediate directory
  final Path second = new Path(first, filename.substring(2, 4), metadataRoot.getType());
  return new Path(second, filename, EnumSet.of(Path.Type.file, Path.Type.encrypted, Path.Type.vault));
}

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

public CryptoDirectoryProvider(final Path vault, final CryptoVault cryptomator) {
  this.home = vault;
  this.dataRoot = new Path(vault, DATA_DIR_NAME, vault.getType());
  this.cryptomator = cryptomator;
}

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

protected void setObjectValueForItem(final Path item, final NSObject value, final String identifier) {
  if(log.isDebugEnabled()) {
    log.debug(String.format("Set new value %s for item %s", value, item));
  }
  if(identifier.equals(BrowserColumn.filename.name())) {
    if(StringUtils.isNotBlank(value.toString()) && !item.getName().equals(value.toString())) {
      final Path renamed = new Path(item.getParent(), value.toString(), item.getType(), item.attributes());
      new MoveController(controller).rename(item, renamed);
    }
  }
}

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

private void upload(final Host bookmark, final List<Local> files, final Path destination) {
  final List<TransferItem> roots = new ArrayList<TransferItem>();
  for(Local file : files) {
    roots.add(new TransferItem(new Path(destination, file.getName(),
      file.isDirectory() ? EnumSet.of(Path.Type.directory) : EnumSet.of(Path.Type.file)), file));
  }
  final TransferController t = TransferControllerFactory.get();
  t.start(new UploadTransfer(bookmark, roots), new TransferOptions());
}

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

public CryptoVault(final Path home, final String masterkey, final byte[] pepper) {
  this.home = home;
  this.masterkey = new Path(home, masterkey, EnumSet.of(Path.Type.file, Path.Type.vault));
  this.pepper = pepper;
  // New vault home with vault flag set for internal use
  final EnumSet<AbstractPath.Type> type = EnumSet.copyOf(home.getType());
  type.add(Path.Type.vault);
  final Path vault = new Path(home.getAbsolute(), type, new PathAttributes(home.attributes()));
  this.filenameProvider = new CryptoFilenameProvider(vault);
  this.directoryProvider = new CryptoDirectoryProvider(vault, this);
}

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

public Path parse(final String uri) {
    final Host host = new HostParser(factory).get(uri);
    if(StringUtils.isBlank(host.getDefaultPath())) {
      return new Path(String.valueOf(Path.DELIMITER), EnumSet.of(detector.detect(host.getDefaultPath())));
    }
    return new Path(PathNormalizer.normalize(host.getDefaultPath()), EnumSet.of(detector.detect(host.getDefaultPath())));
  }
}

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

@Override
public void callback(final int returncode) {
  final Path directory = new UploadTargetFinder(workdir).find(selected);
  switch(returncode) {
    case DEFAULT_OPTION:
    case ALTERNATE_OPTION:
      this.callback(returncode, new Path(directory, inputField.stringValue(), EnumSet.of(Path.Type.file)));
      break;
  }
}

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

@Override
  public Path find(final Path root, final String path) {
    final Path home = super.find(root, path);
    if(containerService.isContainer(home)) {
      return new Path(home.getParent(), home.getName(), EnumSet.of(Path.Type.volume, Path.Type.directory));
    }
    return home;
  }
}

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

@Override
public Path find() throws BackgroundException {
  final Path home = super.find();
  if(containerService.isContainer(home)) {
    return new Path(home.getParent(), home.getName(), EnumSet.of(Path.Type.volume, Path.Type.directory));
  }
  return home;
}

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

protected Path expand(final Path remote, final String format) {
    if(remote.getAbsolute().startsWith(format)) {
      return new Path(StringUtils.replaceOnce(remote.getAbsolute(), format, workdir.getAbsolute()),
          remote.getType());
    }
    return remote;
  }
}

代码示例来源: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 Path move(final Path file, final Path renamed, final TransferStatus status, final Delete.Callback callback, final ConnectionCallback connectionCallback) throws BackgroundException {
  if(status.isExists()) {
    new LocalDeleteFeature(session).delete(Collections.singletonList(renamed), new DisabledPasswordCallback(), callback);
  }
  if(!session.toPath(file).toFile().renameTo(session.toPath(renamed).toFile())) {
    throw new LocalExceptionMappingService().map("Cannot rename {0}", new NoSuchFileException(file.getName()), file);
  }
  // Copy attributes from original file
  return new Path(renamed.getParent(), renamed.getName(), renamed.getType(),
    new LocalAttributesFinderFeature(session).find(renamed));
}

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

@Override
public Path mkdir(final Path folder, final String region, final TransferStatus status) throws BackgroundException {
  try {
    Files.createDirectory(session.toPath(folder));
  }
  catch(IOException e) {
    throw new LocalExceptionMappingService().map("Cannot create folder {0}", e, folder);
  }
  return new Path(folder.getParent(), folder.getName(), folder.getType(),
    new LocalAttributesFinderFeature(session).find(folder));
}

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

@Override
public Path copy(final Path source, final Path target, final TransferStatus status, final ConnectionCallback callback) throws BackgroundException {
  try {
    Files.copy(session.toPath(source), session.toPath(target), StandardCopyOption.REPLACE_EXISTING);
    // Copy attributes from original file
    return new Path(target.getParent(), target.getName(), target.getType(),
      new LocalAttributesFinderFeature(session).find(target));
  }
  catch(IOException e) {
    throw new LocalExceptionMappingService().map("Cannot copy {0}", e, source);
  }
}

代码示例来源: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);
  }
}

代码示例来源: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));
  }
  new DefaultStreamCloser().close(writer.write(file, status, new DisabledConnectionCallback()));
  return new Path(file.getParent(), file.getName(), file.getType(), new AzureAttributesFinderFeature(session, context).find(file));
}

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

@Override
public Path mkdir(final Path folder, final String region, final TransferStatus status) throws BackgroundException {
  try {
    if(!session.getClient().makeDirectory(folder.getAbsolute())) {
      throw new FTPException(session.getClient().getReplyCode(), session.getClient().getReplyString());
    }
  }
  catch(IOException e) {
    throw new FTPExceptionMappingService().map("Cannot create folder {0}", e, folder);
  }
  return new Path(folder.getParent(), folder.getName(), folder.getType(), new DefaultAttributesFinderFeature(session).find(folder));
}

代码示例来源: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.setLength(0L);
  final StatusOutputStream<StorageObject> out = writer.write(file, status, new DisabledConnectionCallback());
  new DefaultStreamCloser().close(out);
  final S3Object metadata = (S3Object) out.getStatus();
  return new Path(file.getParent(), file.getName(), file.getType(),
    new S3AttributesFinderFeature(session).toAttributes(metadata));
}

相关文章