本文整理了Java中org.apache.jena.atlas.io.IO.openFileEx()
方法的一些代码示例,展示了IO.openFileEx()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。IO.openFileEx()
方法的具体详情如下:
包路径:org.apache.jena.atlas.io.IO
类名称:IO
方法名:openFileEx
[英]Open an input stream to a file; do not mask IOExceptions. If the filename is null or "-", return System.in If the filename ends in .gz, wrap in GZIPInputStream
[中]打开文件的输入流;不要掩盖异常。如果文件名为null或“-”,则返回System。如果文件名以结尾,则为。gz,用GZIPInputStream包装
代码示例来源:origin: apache/jena
/** Open an input stream to a file.
* If the filename is null or "-", return System.in
* If the filename ends in .gz, wrap in GZIPInputStream
*/
static public InputStream openFile(String filename) {
try { return openFileEx(filename) ; }
catch (IOException ex) { IO.exception(ex); return null ; }
}
代码示例来源:origin: org.apache.jena/jena-base
/** Open an input stream to a file.
* If the filename is null or "-", return System.in
* If the filename ends in .gz, wrap in GZIPInputStream
*/
static public InputStream openFile(String filename) {
try { return openFileEx(filename) ; }
catch (IOException ex) { IO.exception(ex); return null ; }
}
代码示例来源:origin: apache/jena
/**
* Open an input stream to a file and buffer it. If the filename is null or "-",
* return System.in If the filename ends in .gz, wrap in GZIPInputStream.
* If using this {@code InputStream} with an {@code InputStreamReader}
* (e.g. to get UTF-8), there is no need to buffer the {@code InputStream}.
* Instead, buffer the {@code Reader}.
*/
static public InputStream openFileBuffered(String filename) {
try {
InputStream in = openFileEx(filename) ;
return new BufferedInputStream(in, BUFFER_SIZE) ;
} catch (IOException ex) { IO.exception(ex); return null ; }
}
代码示例来源:origin: org.apache.clerezza.ext/org.apache.jena.jena-arq
/** Open an input stream to a file.
* If the filename is null or "-", return System.in
* If the filename ends in .gz, wrap in GZIPInputStream
*/
static public InputStream openFile(String filename)
{
try {
return openFileEx(filename) ;
}
catch (Exception ex) { throw new AtlasException(ex) ; }
}
代码示例来源:origin: org.apache.jena/jena-base
/**
* Open an input stream to a file and buffer it. If the filename is null or "-",
* return System.in If the filename ends in .gz, wrap in GZIPInputStream.
* If using this {@code InputStream} with an {@code InputStreamReader}
* (e.g. to get UTF-8), there is no need to buffer the {@code InputStream}.
* Instead, buffer the {@code Reader}.
*/
static public InputStream openFileBuffered(String filename) {
try {
InputStream in = openFileEx(filename) ;
return new BufferedInputStream(in, BUFFER_SIZE) ;
} catch (IOException ex) { IO.exception(ex); return null ; }
}
代码示例来源:origin: org.apache.clerezza.ext/org.apache.jena.jena-arq
/** Read a JSON object from a file */
public static JsonObject read(String filename)
{
try
{
InputStream in = IO.openFileEx(filename) ;
try { return JSON.parse(in) ; } finally { in.close() ; }
}
catch (FileNotFoundException ex)
{
throw new RuntimeException("File not found: "+filename, ex) ;
}
catch (IOException ex)
{
IO.exception("IOException: "+filename, ex);
return null ;
}
}
代码示例来源:origin: apache/jena
/** Read any JSON value, not just an object, from a file */
public static JsonValue readAny(String filename) {
try {
try (InputStream in = IO.openFileEx(filename)) {
return JSON.parseAny(in) ;
}
}
catch (FileNotFoundException ex) {
throw new RuntimeException("File not found: " + filename, ex) ;
}
catch (IOException ex) {
IO.exception("IOException: " + filename, ex) ;
return null ;
}
}
代码示例来源:origin: org.apache.clerezza.ext/org.apache.jena.jena-arq
/** Read any JSON value, not just an object, from a file */
public static JsonValue readAny(String filename)
{
try
{
InputStream in = IO.openFileEx(filename) ;
try { return JSON.parseAny(in) ; } finally { in.close() ; }
}
catch (FileNotFoundException ex)
{
throw new RuntimeException("File not found: "+filename, ex) ;
}
catch (IOException ex)
{
IO.exception("IOException: "+filename, ex);
return null ;
}
}
代码示例来源:origin: apache/jena
InputStream in = IO.openFileEx(fn) ;
代码示例来源:origin: org.apache.clerezza.ext/org.apache.jena.jena-arq
InputStream in = IO.openFileEx(fn) ;
代码示例来源:origin: apache/jena
/** Read a JSON object from a file */
public static JsonObject read(String filename) {
try (InputStream in = IO.openFileEx(filename)) {
return JSON.parse(in) ;
}
catch (FileNotFoundException ex) {
IO.exception("File not found: " + filename, ex) ;
return null ;
}
catch (IOException ex) {
IO.exception("IOException: " + filename, ex) ;
return null ;
}
}
代码示例来源:origin: apache/jena
/**
* Read from a file if possible.
* Return null if the file is not found or has a syntax error.
*/
public static StoreParams read(String filename) {
try {
InputStream in = IO.openFileEx(filename);
if ( in == null )
return null;
JsonObject obj = JSON.parse(in) ;
return StoreParamsCodec.decode(obj) ;
} catch (FileNotFoundException ex) {
return null;
} catch (JsonParseException ex) {
FmtLog.warn(StoreParamsCodec.class, "Ignoring store params : Syntax error in '%s': [line:%d, col:%d] %s", filename, ex.getLine(), ex.getColumn(), ex.getMessage());
return null ;
} catch (IOException e) {
IO.exception(e);
return null;
}
}
代码示例来源:origin: apache/jena
/**
* Read from a file if possible.
* Return null if the file is not found or has a syntax error.
*/
public static StoreParams read(String filename) {
try {
InputStream in = IO.openFileEx(filename);
if ( in == null )
return null;
JsonObject obj = JSON.parse(in) ;
return StoreParamsCodec.decode(obj) ;
} catch (FileNotFoundException ex) {
return null;
} catch (JsonParseException ex) {
FmtLog.warn(StoreParamsCodec.class, "Ignoring store params : Syntax error in '%s': [line:%d, col:%d] %s", filename, ex.getLine(), ex.getColumn(), ex.getMessage());
return null ;
} catch (IOException e) {
IO.exception(e);
return null;
}
}
内容来源于网络,如有侵权,请联系作者删除!