ch.cyberduck.core.features.Write类的使用及代码示例

x33g5p2x  于2022-02-03 转载在 其他  
字(6.3k)|赞(0)|评价(0)|浏览(88)

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

Write介绍

暂无

代码示例

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

@Override
public ChecksumCompute checksum(final Path file) {
  return new CryptoChecksumCompute(proxy.checksum(file), vault);
}

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

@Override
public Append append(final Path file, final Long length, final Cache<Path> cache) throws BackgroundException {
  return proxy.append(file, length, cache);
}

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

@Override
  public boolean random() {
    return proxy.random();
  }
}

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

public void write(final Path file, final byte[] content, final TransferStatus status) throws BackgroundException {
    final Write<?> write = session._getFeature(Write.class);
    status.setLength(content.length);
    status.setChecksum(write.checksum(file).compute(new ByteArrayInputStream(content), status));
    final StatusOutputStream<?> out = write.write(file, status, new DisabledConnectionCallback());
    try {
      IOUtils.write(content, out);
    }
    catch(IOException e) {
      throw new DefaultIOExceptionMappingService().map(e);
    }
    finally {
      new DefaultStreamCloser().close(out);
    }
  }
}

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

@Override
public StatusOutputStream<T> write(final Path file, final TransferStatus status, final ConnectionCallback callback) throws BackgroundException {
  return registry.find(session, file).getFeature(session, Write.class, proxy).write(file, status, callback);
}

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

@Override
public boolean temporary() {
  return proxy.temporary();
}

代码示例来源: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 StatusOutputStream<VersionId> write(final Path file, final TransferStatus status, final ConnectionCallback callback) throws BackgroundException {
  if(nodeid.isEncrypted(file)) {
    // File key is set in encryption bulk feature if container is encrypted
    return new CryptoWriteFeature(session, proxy).write(file, status, callback);
  }
  return proxy.write(file, status, callback);
}

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

@Override
public boolean temporary() {
  return proxy.temporary();
}

代码示例来源: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 ChecksumCompute checksum(final Path file) {
  try {
    return registry.find(session, file).getFeature(session, Write.class, proxy).checksum(file);
  }
  catch(VaultUnlockCancelException e) {
    return proxy.checksum(file);
  }
}

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

@Override
public StatusOutputStream<VersionId> write(final Path file, final TransferStatus status, final ConnectionCallback callback) throws BackgroundException {
  try {
    final ObjectReader reader = session.getClient().getJSON().getContext(null).readerFor(FileKey.class);
    if(log.isDebugEnabled()) {
      log.debug(String.format("Read file key for file %s", file));
    }
    final FileKey fileKey = reader.readValue(status.getFilekey().array());
    return new CryptoOutputStream<VersionId>(session, proxy.write(file, status, callback),
        Crypto.createFileEncryptionCipher(TripleCryptConverter.toCryptoPlainFileKey(fileKey)), status
    );
  }
  catch(CryptoSystemException | InvalidFileKeyException e) {
    throw new CryptoExceptionMappingService().map("Upload {0} failed", e, file);
  }
  catch(IOException e) {
    throw new DefaultIOExceptionMappingService().map("Upload {0} failed", e, file);
  }
}

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

@Override
public Write.Append append(final Path file, final Long length, final Cache<Path> cache) throws BackgroundException {
  return writer.append(file, length, cache);
}

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

@Override
public boolean temporary() {
  return proxy.temporary();
}

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

@Override
public boolean random() {
  return proxy.random();
}

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

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

@Override
  public ChecksumCompute checksum(final Path file) {
    if(Boolean.valueOf(containerService.getContainer(file).attributes().getCustom().get(SDSAttributesFinderFeature.KEY_ENCRYPTED))) {
      return new CryptoWriteFeature(session, proxy).checksum(file);
    }
    return proxy.checksum(file);
  }
}

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

@Override
public Reply upload(final Path file, final Local local, final BandwidthThrottle throttle,
          final StreamListener listener, final TransferStatus status,
          final ConnectionCallback callback) throws BackgroundException {
  final InputStream in = local.getInputStream();
  final StatusOutputStream<Reply> out = writer.write(file, status, callback);
  new StreamCopier(status, status)
    .withOffset(status.getOffset())
    .withLimit(status.getLength())
    .withListener(listener)
    .transfer(in, new ThrottledOutputStream(out, throttle));
  return out.getStatus();
}

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

@Override
public Write.Append append(final Path file, final Long length, final Cache<Path> cache) throws BackgroundException {
  return writer.append(file, length, cache);
}

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

@Override
public boolean temporary() {
  return proxy.temporary();
}

相关文章