de.lmu.ifi.dbs.elki.utilities.io.FileUtil.tryGzipInput()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(6.0k)|赞(0)|评价(0)|浏览(150)

本文整理了Java中de.lmu.ifi.dbs.elki.utilities.io.FileUtil.tryGzipInput()方法的一些代码示例,展示了FileUtil.tryGzipInput()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。FileUtil.tryGzipInput()方法的具体详情如下:
包路径:de.lmu.ifi.dbs.elki.utilities.io.FileUtil
类名称:FileUtil
方法名:tryGzipInput

FileUtil.tryGzipInput介绍

[英]Try to open a stream as gzip, if it starts with the gzip magic.
[中]尝试打开一个流作为gzip,如果它以gzip魔术开始。

代码示例

代码示例来源:origin: elki-project/elki

/**
 * Constructor.
 * 
 * @param filters Filters, can be null
 * @param parser the parser to provide a database
 * @param infile File to load the data from
 */
public FileBasedDatabaseConnection(List<ObjectFilter> filters, Parser parser, File infile) {
 super(() -> {
  try {
   return new BufferedInputStream(FileUtil.tryGzipInput(new FileInputStream(infile)));
  }
  catch(IOException e) {
   throw new AbortException("Could not load input file: " + infile, e);
  }
 }, filters, parser);
}

代码示例来源:origin: elki-project/elki

/**
 * Constructor.
 * 
 * @param filters Filters, can be null
 * @param parser the parser to provide a database
 * @param infile File to load the data from
 */
public FileBasedDatabaseConnection(List<ObjectFilter> filters, Parser parser, String infile) {
 super(() -> {
  try {
   return new BufferedInputStream(FileUtil.tryGzipInput(new FileInputStream(infile)));
  }
  catch(IOException e) {
   throw new AbortException("Could not load input file: " + infile, e);
  }
 }, filters, parser);
}

代码示例来源:origin: de.lmu.ifi.dbs.elki/elki-input

/**
 * Constructor.
 * 
 * @param filters Filters, can be null
 * @param parser the parser to provide a database
 * @param infile File to load the data from
 */
public FileBasedDatabaseConnection(List<ObjectFilter> filters, Parser parser, String infile) {
 super(() -> {
  try {
   return new BufferedInputStream(FileUtil.tryGzipInput(new FileInputStream(infile)));
  }
  catch(IOException e) {
   throw new AbortException("Could not load input file: " + infile, e);
  }
 }, filters, parser);
}

代码示例来源:origin: de.lmu.ifi.dbs.elki/elki-input

/**
 * Constructor.
 * 
 * @param filters Filters, can be null
 * @param parser the parser to provide a database
 * @param infile File to load the data from
 */
public FileBasedDatabaseConnection(List<ObjectFilter> filters, Parser parser, File infile) {
 super(() -> {
  try {
   return new BufferedInputStream(FileUtil.tryGzipInput(new FileInputStream(infile)));
  }
  catch(IOException e) {
   throw new AbortException("Could not load input file: " + infile, e);
  }
 }, filters, parser);
}

代码示例来源:origin: elki-project/elki

@Override
public <O extends DBID> DistanceQuery<O> instantiate(Relation<O> relation) {
 if(cache == null) {
  try {
   loadCache(relation.size(), new BufferedInputStream(FileUtil.tryGzipInput(new FileInputStream(matrixfile))));
  }
  catch(IOException e) {
   throw new AbortException("Could not load external distance file: " + matrixfile.toString(), e);
  }
 }
 return super.instantiate(relation);
}

代码示例来源:origin: de.lmu.ifi.dbs.elki/elki-precomputed

@Override
public <O extends DBID> DistanceQuery<O> instantiate(Relation<O> relation) {
 if(cache == null) {
  try {
   loadCache(relation.size(), new BufferedInputStream(FileUtil.tryGzipInput(new FileInputStream(matrixfile))));
  }
  catch(IOException e) {
   throw new AbortException("Could not load external distance file: " + matrixfile.toString(), e);
  }
 }
 return super.instantiate(relation);
}

代码示例来源:origin: elki-project/elki

@Override
public <O extends DBID> DistanceQuery<O> instantiate(Relation<O> relation) {
 if(cache == null) {
  int size = relation.size();
  try {
   loadCache(size, new BufferedInputStream(FileUtil.tryGzipInput(new FileInputStream(matrixfile))));
  }
  catch(IOException e) {
   throw new AbortException("Could not load external distance file: " + matrixfile.toString(), e);
  }
 }
 return super.instantiate(relation);
}

代码示例来源:origin: de.lmu.ifi.dbs.elki/elki-precomputed

@Override
public <O extends DBID> DistanceQuery<O> instantiate(Relation<O> relation) {
 if(cache == null) {
  int size = relation.size();
  try {
   loadCache(size, new BufferedInputStream(FileUtil.tryGzipInput(new FileInputStream(matrixfile))));
  }
  catch(IOException e) {
   throw new AbortException("Could not load external distance file: " + matrixfile.toString(), e);
  }
 }
 return super.instantiate(relation);
}

代码示例来源:origin: elki-project/elki

@Override
public void run() {
 try (FileInputStream fis = new FileInputStream(infile); //
   InputStream is = new BufferedInputStream(FileUtil.tryGzipInput(fis)); //
   FileOutputStream fosResult = new FileOutputStream(outfile, true);
   PrintStream fout = new PrintStream(fosResult);

代码示例来源:origin: de.lmu.ifi.dbs.elki/elki-outlier

InputStream in = FileUtil.tryGzipInput(fis);
 BufferedReader br = new BufferedReader(new InputStreamReader(in))) {
for(String line; (line = br.readLine()) != null;) {

代码示例来源:origin: elki-project/elki

Clustering<? extends Model> m = null;
try (FileInputStream fis = new FileInputStream(file); //
  InputStream in = FileUtil.tryGzipInput(fis); //
  TokenizedReader reader = CSVReaderFormat.DEFAULT_FORMAT.makeReader()) {
 Tokenizer tokenizer = reader.getTokenizer();

代码示例来源:origin: elki-project/elki

InputStream in = FileUtil.tryGzipInput(fis);
 BufferedReader br = new BufferedReader(new InputStreamReader(in))) {
for(String line; (line = br.readLine()) != null;) {

代码示例来源:origin: de.lmu.ifi.dbs.elki/elki-clustering

Clustering<? extends Model> m = null;
try (FileInputStream fis = new FileInputStream(file); //
  InputStream in = FileUtil.tryGzipInput(fis); //
  TokenizedReader reader = CSVReaderFormat.DEFAULT_FORMAT.makeReader()) {
 Tokenizer tokenizer = reader.getTokenizer();

代码示例来源:origin: elki-project/elki

String filestr = file.getPath();
try (FileInputStream fis = new FileInputStream(file); //
  InputStream inputStream = FileUtil.tryGzipInput(new BufferedInputStream(fis))) {
 final BundleStreamSource source;
 if(parser instanceof StreamingParser) {

代码示例来源:origin: de.lmu.ifi.dbs.elki/elki-input

String filestr = file.getPath();
try (FileInputStream fis = new FileInputStream(file); //
  InputStream inputStream = FileUtil.tryGzipInput(new BufferedInputStream(fis))) {
 final BundleStreamSource source;
 if(parser instanceof StreamingParser) {

代码示例来源:origin: elki-project/elki

InputStream in = FileUtil.tryGzipInput(fis); //
 TokenizedReader reader = CSVReaderFormat.DEFAULT_FORMAT.makeReader()) {
Tokenizer tokenizer = reader.getTokenizer();

代码示例来源:origin: de.lmu.ifi.dbs.elki/elki-outlier

InputStream in = FileUtil.tryGzipInput(fis); //
 TokenizedReader reader = CSVReaderFormat.DEFAULT_FORMAT.makeReader()) {
Tokenizer tokenizer = reader.getTokenizer();

相关文章