本文整理汇总了Java中org.apache.lucene.benchmark.byTask.utils.StreamUtils.outputStream方法的典型用法代码示例。如果您正苦于以下问题:Java StreamUtils.outputStream方法的具体用法?Java StreamUtils.outputStream怎么用?Java StreamUtils.outputStream使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.lucene.benchmark.byTask.utils.StreamUtils
的用法示例。
在下文中一共展示了StreamUtils.outputStream方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: WriteLineDocTask
import org.apache.lucene.benchmark.byTask.utils.StreamUtils; //导入方法依赖的package包/类
public WriteLineDocTask(PerfRunData runData) throws Exception {
super(runData);
Config config = runData.getConfig();
fname = config.get("line.file.out", null);
if (fname == null) {
throw new IllegalArgumentException("line.file.out must be set");
}
OutputStream out = StreamUtils.outputStream(new File(fname));
lineFileOut = new PrintWriter(new BufferedWriter(new OutputStreamWriter(out, StandardCharsets.UTF_8), StreamUtils.BUFFER_SIZE));
docMaker = runData.getDocMaker();
// init fields
String f2r = config.get("line.fields",null);
if (f2r == null) {
fieldsToWrite = DEFAULT_FIELDS;
} else {
if (f2r.indexOf(SEP)>=0) {
throw new IllegalArgumentException("line.fields "+f2r+" should not contain the separator char: "+SEP);
}
fieldsToWrite = f2r.split(",");
}
// init sufficient fields
sufficientFields = new boolean[fieldsToWrite.length];
String suff = config.get("sufficient.fields",DEFAULT_SUFFICIENT_FIELDS);
if (",".equals(suff)) {
checkSufficientFields = false;
} else {
checkSufficientFields = true;
HashSet<String> sf = new HashSet<>(Arrays.asList(suff.split(",")));
for (int i=0; i<fieldsToWrite.length; i++) {
if (sf.contains(fieldsToWrite[i])) {
sufficientFields[i] = true;
}
}
}
writeHeader(lineFileOut);
}
示例2: WriteLineDocTask
import org.apache.lucene.benchmark.byTask.utils.StreamUtils; //导入方法依赖的package包/类
public WriteLineDocTask(PerfRunData runData) throws Exception {
super(runData);
Config config = runData.getConfig();
fname = config.get("line.file.out", null);
if (fname == null) {
throw new IllegalArgumentException("line.file.out must be set");
}
OutputStream out = StreamUtils.outputStream(new File(fname));
lineFileOut = new PrintWriter(new BufferedWriter(new OutputStreamWriter(out, "UTF-8"), StreamUtils.BUFFER_SIZE));
docMaker = runData.getDocMaker();
// init fields
String f2r = config.get("line.fields",null);
if (f2r == null) {
fieldsToWrite = DEFAULT_FIELDS;
} else {
if (f2r.indexOf(SEP)>=0) {
throw new IllegalArgumentException("line.fields "+f2r+" should not contain the separator char: "+SEP);
}
fieldsToWrite = f2r.split(",");
}
// init sufficient fields
sufficientFields = new boolean[fieldsToWrite.length];
String suff = config.get("sufficient.fields",DEFAULT_SUFFICIENT_FIELDS);
if (",".equals(suff)) {
checkSufficientFields = false;
} else {
checkSufficientFields = true;
HashSet<String> sf = new HashSet<String>(Arrays.asList(suff.split(",")));
for (int i=0; i<fieldsToWrite.length; i++) {
if (sf.contains(fieldsToWrite[i])) {
sufficientFields[i] = true;
}
}
}
writeHeader(lineFileOut);
}
示例3: WriteEnwikiLineDocTask
import org.apache.lucene.benchmark.byTask.utils.StreamUtils; //导入方法依赖的package包/类
public WriteEnwikiLineDocTask(PerfRunData runData) throws Exception {
super(runData);
OutputStream out = StreamUtils.outputStream(categoriesLineFile(new File(fname)));
categoryLineFileOut = new PrintWriter(new BufferedWriter(new OutputStreamWriter(out, StandardCharsets.UTF_8), StreamUtils.BUFFER_SIZE));
writeHeader(categoryLineFileOut);
}
示例4: WriteEnwikiLineDocTask
import org.apache.lucene.benchmark.byTask.utils.StreamUtils; //导入方法依赖的package包/类
public WriteEnwikiLineDocTask(PerfRunData runData) throws Exception {
super(runData);
OutputStream out = StreamUtils.outputStream(categoriesLineFile(new File(fname)));
categoryLineFileOut = new PrintWriter(new BufferedWriter(new OutputStreamWriter(out, "UTF-8"), StreamUtils.BUFFER_SIZE));
writeHeader(categoryLineFileOut);
}
示例5: autoOutFile
import org.apache.lucene.benchmark.byTask.utils.StreamUtils; //导入方法依赖的package包/类
private File autoOutFile(String ext) throws Exception {
File f = new File(testDir,"testfile." + ext);
OutputStream os = StreamUtils.outputStream(f);
writeText(os);
return f;
}