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

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

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

FileUtil.getFilenameExtension介绍

[英]Returns the lower case extension of the selected file. If no file is selected, null is returned.
[中]返回所选文件的小写扩展名。如果未选择任何文件,则返回null

代码示例

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

/**
 * Returns the lower case extension of the selected file.
 * 
 * If no file is selected, <code>null</code> is returned.
 * 
 * @param file File object
 * @return Returns the extension of the selected file in lower case or
 *         <code>null</code>
 */
public static String getFilenameExtension(File file) {
 return getFilenameExtension(file.getName());
}

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

/**
 * Returns the lower case extension of the selected file.
 * 
 * If no file is selected, <code>null</code> is returned.
 * 
 * @param file File object
 * @return Returns the extension of the selected file in lower case or
 *         <code>null</code>
 */
public static String getFilenameExtension(File file) {
 return getFilenameExtension(file.getName());
}

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

/**
 * Guess a supported format from the file name. For "auto" format handling.
 *
 * @param name File name
 * @return format or "null"
 */
public static String guessFormat(String name) {
 String ext = FileUtil.getFilenameExtension(name);
 for(String format : FORMATS) {
  if(format.equals(ext)) {
   return ext;
  }
 }
 return null;
}

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

private StreamFactory openStreamFactory() throws IOException {
 if(out == null) {
  return new SingleStreamOutput(gzip);
 }
 // If it does not exist, make a folder.
 final String ext = FileUtil.getFilenameExtension(out);
 if(!(out.exists() || "gz".equals(ext) || "csv".equals(ext) || "ascii".equals(ext) || "txt".equals(ext))) {
  LOG.info("Creating output directory: " + out);
  out.mkdirs();
 }
 if(out.isDirectory()) {
  if(warnoverwrite && out.listFiles().length > 0) {
   LOG.warning("Output directory specified is not empty. Files will be overwritten and old files may be left over.");
  }
  return new MultipleFilesOutput(out, gzip);
 }
 else {
  if(warnoverwrite && out.exists() && out.length() > 0) {
   LOG.warning("Output file exists and will be overwritten!");
  }
  return new SingleStreamOutput(out, gzip);
 }
}

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

String extension = FileUtil.getFilenameExtension(file);
if("svg".equals(extension)) {
 saveAsSVG(file);

相关文章