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


Java StreamUtils.outputStream方法代码示例

本文整理汇总了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);
}
 
开发者ID:europeana,项目名称:search,代码行数:40,代码来源:WriteLineDocTask.java

示例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);
}
 
开发者ID:pkarmstr,项目名称:NYBC,代码行数:40,代码来源:WriteLineDocTask.java

示例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);
}
 
开发者ID:europeana,项目名称:search,代码行数:7,代码来源:WriteEnwikiLineDocTask.java

示例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);
}
 
开发者ID:pkarmstr,项目名称:NYBC,代码行数:7,代码来源:WriteEnwikiLineDocTask.java

示例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;
}
 
开发者ID:pkarmstr,项目名称:NYBC,代码行数:7,代码来源:StreamUtilsTest.java


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