org.apache.jena.util.FileUtils.openResourceFile()方法的使用及代码示例

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

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

FileUtils.openResourceFile介绍

[英]Answer a BufferedReader than reads from the named resource file as UTF-8, possibly throwing WrappedIOExceptions.
[中]回答BufferedReader,然后以UTF-8的形式从命名的资源文件中读取,可能引发WrappedIO异常。

代码示例

代码示例来源:origin: apache/jena

/**
 * Open a resource file and read it all into a single string.
 * Treats lines starting with # as comment lines, as per stringFromReader
 */
public static Rule.Parser loadRuleParserFromResourceFile( String filename ) {
  return Rule.rulesParserFromReader( FileUtils.openResourceFile( filename ) );
}

代码示例来源:origin: org.apache.jena/jena-core

/**
 * Open a resource file and read it all into a single string.
 * Treats lines starting with # as comment lines, as per stringFromReader
 */
public static Rule.Parser loadRuleParserFromResourceFile( String filename ) {
  return Rule.rulesParserFromReader( FileUtils.openResourceFile( filename ) );
}

代码示例来源:origin: apache/jena

/**
 * Load a set of rule definitions including processing of
 * comment lines and any initial prefix definition lines.
 * Also notes the prefix definitions for adding to a later inf model.
 */
public static List<Rule> loadRules(String filename, Map<String, String> prefixes) {
  String fname = filename;
  if (fname.startsWith("file:///")) {
    fname = File.separator + fname.substring(8);
  } else if (fname.startsWith("file:/")) {
    fname = File.separator + fname.substring(6);
  } else if (fname.startsWith("file:")) {
    fname = fname.substring(5);
  }
  BufferedReader src = FileUtils.openResourceFile(fname);
  return loadRules(src, prefixes);
}

代码示例来源:origin: org.apache.jena/jena-cmds

/**
 * Load a set of rule definitions including processing of
 * comment lines and any initial prefix definition lines.
 * Also notes the prefix definitions for adding to a later inf model.
 */
public static List<Rule> loadRules(String filename, Map<String, String> prefixes) {
  String fname = filename;
  if (fname.startsWith("file:///")) {
    fname = File.separator + fname.substring(8);
  } else if (fname.startsWith("file:/")) {
    fname = File.separator + fname.substring(6);
  } else if (fname.startsWith("file:")) {
    fname = fname.substring(5);
  }
  BufferedReader src = FileUtils.openResourceFile(fname);
  return loadRules(src, prefixes);
}

相关文章