
com.qiniu.datasource.QiniuOssContainer Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of qsuits Show documentation
Show all versions of qsuits Show documentation
qiniu-suits is a efficient tools for qiniu api implemented by java8.
package com.qiniu.datasource;
import com.qiniu.common.SuitsException;
import com.qiniu.convert.QOSObjToMap;
import com.qiniu.convert.QOSObjToString;
import com.qiniu.interfaces.ITypeConvert;
import com.qiniu.persistence.FileSaveMapper;
import com.qiniu.persistence.IResultOutput;
import com.qiniu.storage.BucketManager;
import com.qiniu.storage.Configuration;
import com.qiniu.storage.model.FileInfo;
import com.qiniu.util.Auth;
import java.io.BufferedWriter;
import java.io.IOException;
import java.util.*;
public class QiniuOssContainer extends OssContainer> {
private String accessKey;
private String secretKey;
private Configuration configuration;
public QiniuOssContainer(String accessKey, String secretKey, Configuration configuration, String bucket,
List antiPrefixes, Map prefixesMap, boolean prefixLeft,
boolean prefixRight, Map indexMap, int unitLen, int threads) {
super(bucket, antiPrefixes, prefixesMap, prefixLeft, prefixRight, indexMap, unitLen, threads);
this.accessKey = accessKey;
this.secretKey = secretKey;
this.configuration = configuration;
}
@Override
public String getSourceName() {
return "qiniu";
}
@Override
protected ITypeConvert> getNewConverter() {
return new QOSObjToMap(indexMap);
}
@Override
protected ITypeConvert getNewStringConverter() throws IOException {
return new QOSObjToString(saveFormat, saveSeparator, rmFields);
}
@Override
protected IResultOutput getNewResultSaver(String order) throws IOException {
return order != null ? new FileSaveMapper(savePath, getSourceName(), order) : new FileSaveMapper(savePath);
}
@Override
protected ILister getLister(String prefix, String marker, String end) throws SuitsException {
return new QiniuLister(new BucketManager(Auth.create(accessKey, secretKey), configuration.clone()), bucket,
prefix, marker, end, null, unitLen);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy