当前位置: 首页>>代码示例>>Java>>正文


Java TransferOptions类代码示例

本文整理汇总了Java中org.irods.jargon.core.packinstr.TransferOptions的典型用法代码示例。如果您正苦于以下问题:Java TransferOptions类的具体用法?Java TransferOptions怎么用?Java TransferOptions使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


TransferOptions类属于org.irods.jargon.core.packinstr包,在下文中一共展示了TransferOptions类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: configure

import org.irods.jargon.core.packinstr.TransferOptions; //导入依赖的package包/类
public TransferOptions configure(final TransferOptions options) {
    options.setPutOption(TransferOptions.PutOptions.NORMAL);
    options.setForceOption(TransferOptions.ForceOption.ASK_CALLBACK_LISTENER);
    options.setMaxThreads(preferences.getInteger("queue.connections.limit"));
    // Enable progress callbacks
    options.setIntraFileStatusCallbacks(true);
    options.setIntraFileStatusCallbacksNumberCallsInterval(1);
    return options;
}
 
开发者ID:iterate-ch,项目名称:cyberduck,代码行数:10,代码来源:DefaultTransferOptionsConfigurer.java

示例2: download

import org.irods.jargon.core.packinstr.TransferOptions; //导入依赖的package包/类
@Override
public void download(final Path file, final Local local, final BandwidthThrottle throttle,
                     final StreamListener listener, final TransferStatus status,
                     final ConnectionCallback connectionCallback, final PasswordCallback passwordCallback) throws BackgroundException {
    try {
        final IRODSFileSystemAO fs = session.getClient();
        final IRODSFile f = fs.getIRODSFileFactory().instanceIRODSFile(file.getAbsolute());
        if(f.exists()) {
            final TransferControlBlock block = DefaultTransferControlBlock.instance(StringUtils.EMPTY,
                    preferences.getInteger("connection.retry"));
            final TransferOptions options = new DefaultTransferOptionsConfigurer().configure(new TransferOptions());
            options.setUseParallelTransfer(session.getHost().getTransferType().equals(Host.TransferType.concurrent));
            block.setTransferOptions(options);
            final DataTransferOperations transfer = fs.getIRODSAccessObjectFactory()
                    .getDataTransferOperations(fs.getIRODSAccount());
            transfer.getOperation(f, new File(local.getAbsolute()),
                    new DefaultTransferStatusCallbackListener(status, listener, block),
                    block);
        }
        else {
            throw new NotfoundException(file.getAbsolute());
        }
    }
    catch(JargonException e) {
        throw new IRODSExceptionMappingService().map("Download {0} failed", e, file);
    }
}
 
开发者ID:iterate-ch,项目名称:cyberduck,代码行数:28,代码来源:IRODSDownloadFeature.java

示例3: upload

import org.irods.jargon.core.packinstr.TransferOptions; //导入依赖的package包/类
@Override
public Checksum upload(final Path file, final Local local, final BandwidthThrottle throttle,
                       final StreamListener listener, final TransferStatus status,
                       final ConnectionCallback callback) throws BackgroundException {
    try {
        final IRODSFileSystemAO fs = session.getClient();
        final IRODSFile f = fs.getIRODSFileFactory().instanceIRODSFile(file.getAbsolute());
        final TransferControlBlock block = DefaultTransferControlBlock.instance(StringUtils.EMPTY,
                preferences.getInteger("connection.retry"));
        final TransferOptions options = new DefaultTransferOptionsConfigurer().configure(new TransferOptions());
        options.setUseParallelTransfer(session.getHost().getTransferType().equals(Host.TransferType.concurrent));
        block.setTransferOptions(options);
        final DataTransferOperations transfer = fs.getIRODSAccessObjectFactory().getDataTransferOperations(fs.getIRODSAccount());
        transfer.putOperation(new File(local.getAbsolute()), f, new DefaultTransferStatusCallbackListener(
                status, listener, block
        ), block);
        if(status.isComplete()) {
            final DataObjectChecksumUtilitiesAO checksum = fs
                    .getIRODSAccessObjectFactory()
                    .getDataObjectChecksumUtilitiesAO(fs.getIRODSAccount());
            final ChecksumValue value = checksum.computeChecksumOnDataObject(f);
            final Checksum fingerprint = Checksum.parse(value.getChecksumStringValue());
            if(null == fingerprint) {
                log.warn(String.format("Unsupported checksum algorithm %s", value.getChecksumEncoding()));
            }
            else {
                if(file.getType().contains(Path.Type.encrypted)) {
                    log.warn(String.format("Skip checksum verification for %s with client side encryption enabled", file));
                }
                else {
                    final Checksum expected = ChecksumComputeFactory.get(fingerprint.algorithm).compute(local.getInputStream(), status);
                    if(!expected.equals(fingerprint)) {
                        throw new ChecksumException(MessageFormat.format(LocaleFactory.localizedString("Upload {0} failed", "Error"), file.getName()),
                                MessageFormat.format("Mismatch between {0} hash {1} of uploaded data and ETag {2} returned by the server",
                                        fingerprint.algorithm.toString(), expected, fingerprint.hash));
                    }
                }
            }
            return fingerprint;
        }
        return null;
    }
    catch(JargonException e) {
        throw new IRODSExceptionMappingService().map(e);
    }
}
 
开发者ID:iterate-ch,项目名称:cyberduck,代码行数:47,代码来源:IRODSUploadFeature.java


注:本文中的org.irods.jargon.core.packinstr.TransferOptions类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。