
com.qiniu.datasource.TenOssContainer 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.qcloud.cos.COSClient;
import com.qcloud.cos.ClientConfig;
import com.qcloud.cos.auth.BasicCOSCredentials;
import com.qcloud.cos.model.COSObjectSummary;
import com.qiniu.common.SuitsException;
import com.qiniu.convert.COSObjToMap;
import com.qiniu.convert.COSObjToString;
import com.qiniu.interfaces.ITypeConvert;
import com.qiniu.persistence.FileSaveMapper;
import com.qiniu.persistence.IResultOutput;
import java.io.BufferedWriter;
import java.io.IOException;
import java.util.*;
public class TenOssContainer extends OssContainer> {
private String secretId;
private String secretKey;
private ClientConfig clientConfig;
public TenOssContainer(String secretId, String secretKey, ClientConfig clientConfig, 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.secretId = secretId;
this.secretKey = secretKey;
this.clientConfig = clientConfig;
}
@Override
public String getSourceName() {
return "tencent";
}
@Override
protected ITypeConvert> getNewConverter() {
return new COSObjToMap(indexMap);
}
@Override
protected ITypeConvert getNewStringConverter() throws IOException {
return new COSObjToString(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 TenLister(new COSClient(new BasicCOSCredentials(secretId, secretKey), clientConfig), bucket, prefix,
marker, end, null, unitLen);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy