本文整理了Java中org.apache.jena.util.FileUtils.getFilenameExt()
方法的一些代码示例,展示了FileUtils.getFilenameExt()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。FileUtils.getFilenameExt()
方法的具体详情如下:
包路径:org.apache.jena.util.FileUtils
类名称:FileUtils
方法名:getFilenameExt
[英]Get the suffix part of a file name or a URL in file-like format.
[中]以类似文件的格式获取文件名或URL的后缀部分。
代码示例来源:origin: apache/jena
/** Guess the language/type of model data.
*
* <ul>
* <li> If the URI ends ".rdf", it is assumed to be RDF/XML</li>
* <li> If the URI ends ".nt", it is assumed to be N-Triples</li>
* <li> If the URI ends ".ttl", it is assumed to be Turtle</li>
* <li> If the URI ends ".owl", it is assumed to be RDF/XML</li>
* </ul>
* @param name URL to base the guess on
* @param otherwise Default guess
* @return String Guessed syntax - or the default supplied
*/
public static String guessLang( String name, String otherwise )
{
String suffix = getFilenameExt( name );
if (suffix.equals( "n3" )) return langN3;
if (suffix.equals( "nt" )) return langNTriple;
if (suffix.equals( "ttl" )) return langTurtle ;
if (suffix.equals( "rdf" )) return langXML;
if (suffix.equals( "owl" )) return langXML;
return otherwise;
}
代码示例来源:origin: org.apache.jena/jena-core
/** Guess the language/type of model data.
*
* <ul>
* <li> If the URI ends ".rdf", it is assumed to be RDF/XML</li>
* <li> If the URI ends ".nt", it is assumed to be N-Triples</li>
* <li> If the URI ends ".ttl", it is assumed to be Turtle</li>
* <li> If the URI ends ".owl", it is assumed to be RDF/XML</li>
* </ul>
* @param name URL to base the guess on
* @param otherwise Default guess
* @return String Guessed syntax - or the default supplied
*/
public static String guessLang( String name, String otherwise )
{
String suffix = getFilenameExt( name );
if (suffix.equals( "n3" )) return langN3;
if (suffix.equals( "nt" )) return langNTriple;
if (suffix.equals( "ttl" )) return langTurtle ;
if (suffix.equals( "rdf" )) return langXML;
if (suffix.equals( "owl" )) return langXML;
return otherwise;
}
代码示例来源:origin: apache/jena
/** Try to map a URI or file name to a {@link Lang}; return null on no registered mapping. */
public static Lang filenameToLang(String filename)
{
if ( filename == null )
return null;
// Remove any URI fragment (there can be only one # in a URI).
// Pragmatically, assume any # is URI related.
// URIs can be relative.
int iHash = filename.indexOf('#');
if ( iHash > 0 )
filename = filename.substring(0, iHash);
// Gzip or BZip2 compressed?
filename = IO.filenameNoCompression(filename);
return fileExtToLang(FileUtils.getFilenameExt(filename));
}
内容来源于网络,如有侵权,请联系作者删除!