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

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

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

Path.getType介绍

暂无

代码示例

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

@Override
  public boolean isSupported(final Path source, final Path target) {
    if(target.isRoot()) {
      return false;
    }
    return !source.getType().contains(Path.Type.placeholder);
  }
}

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

@Override
  public boolean isSupported(final Path source, final Path target) {
    if(target.isRoot()) {
      return false;
    }
    return !source.getType().contains(Path.Type.placeholder);
  }
}

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

@Override
  public boolean isContainer(final Path file) {
    return super.isContainer(file) || file.getType().contains(Path.Type.volume);
  }
}

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

public Path find(final Path selected) {
    if(null == selected) {
      return workdir;
    }
    if(selected.getType().contains(Path.Type.volume)) {
      return selected;
    }
    return selected.getParent();
  }
}

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

@Override
public void visit(final AttributedList<Path> list, final int index, final Path f) {
  try {
    f.getType().add(Path.Type.encrypted);
    list.set(index, vault.decrypt(session, f));
  }
  catch(BackgroundException e) {
    log.error(String.format("Failure decrypting %s. %s", f, e.getDetail()));
    f.getType().remove(Path.Type.encrypted);
  }
}

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

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 Path toDecrypted(final Path file) {
  if(file.getType().contains(Path.Type.encrypted)) {
    if(null == file.attributes().getDecrypted()) {
      log.error(String.format("Missing decrypted reference for %s", file));
    }
    return file.attributes().getDecrypted();
  }
  return file;
}

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

@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 transferStatus) throws BackgroundException {
  final SpectraBulkService bulk = new SpectraBulkService(session);
  final TransferStatus status = new TransferStatus();
  bulk.pre(Transfer.Type.upload, Collections.singletonMap(new TransferItem(file), status.length(0L)), new DisabledConnectionCallback());
  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));
}

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

相关文章