
com.qiniu.convert.OSSObjToString 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.convert;
import com.aliyun.oss.model.OSSObjectSummary;
import com.qiniu.util.LineUtils;
import java.io.IOException;
import java.util.List;
import java.util.Map;
public class OSSObjToString extends Converter {
public OSSObjToString(String format, String separator, List rmFields) throws IOException {
// 将 file info 的字段逐一进行获取是为了控制输出字段的顺序
if ("json".equals(format)) {
stringFormatter = line -> LineUtils.toFormatString(line, rmFields);
} else if ("csv".equals(format)) {
stringFormatter = line -> LineUtils.toFormatString(line, ",", rmFields);
} else if ("tab".equals(format)) {
stringFormatter = line -> LineUtils.toFormatString(line, separator, rmFields);
} else {
throw new IOException("please check your format for map to string.");
}
}
@Override
public String convertToV(OSSObjectSummary line) throws IOException {
return stringFormatter.toFormatString(line);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy