本文整理了Java中org.apache.jena.atlas.io.IO.exception()
方法的一些代码示例,展示了IO.exception()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。IO.exception()
方法的具体详情如下:
包路径:org.apache.jena.atlas.io.IO
类名称:IO
方法名:exception
[英]Throw a RuntimeIOException - this function is guaranteed not to return normally
[中]抛出RuntimeIOException-此函数保证不会正常返回
代码示例来源:origin: apache/jena
@Override
public void flush()
{
try { writer.flush() ; } catch (IOException ex) { IO.exception(ex) ; }
}
代码示例来源:origin: apache/jena
@Override
public void close()
{
try { writer.close() ; } catch (IOException ex) { IO.exception(ex) ; }
}
代码示例来源:origin: apache/jena
@Override
public void close()
{
try { reader.close() ; } catch (IOException ex) { IO.exception(ex) ; }
}
代码示例来源:origin: apache/jena
private void checkPosition(long posn) {
// Allows posn to be exactly the byte beyond the end
if ( posn < 0 || posn > dataLength )
IO.exception(String.format("Position out of bounds: %d in [0,%d]", posn, dataLength)) ;
}
代码示例来源:origin: apache/jena
@Override
public long position() {
try {
return file.position() ;
}
catch (IOException e) {
IO.exception(e) ;
return -1 ;
}
}
代码示例来源:origin: apache/jena
@Override
public int read(ByteBuffer buffer, long loc) {
try {
return file.read(buffer, loc) ;
}
catch (IOException e) {
IO.exception(e) ;
return -1 ;
}
}
代码示例来源:origin: apache/jena
@Override
public int write(ByteBuffer buffer) {
try {
return file.write(buffer) ;
}
catch (IOException e) {
IO.exception(e) ;
return -1 ;
}
}
代码示例来源:origin: apache/jena
@Override
public void close()
{
try { super.close() ; } catch (IOException ex) { IO.exception(ex) ; }
}
}
代码示例来源:origin: apache/jena
private void free() {
try {
if ( fileLock != null )
fileLock.release();
fileChannel.close();
fileLock = null;
} catch (IOException ex) { IO.exception(ex); }
}
代码示例来源:origin: apache/jena
/** Copy a file */
public static void copyFile(File source, File dest) {
try {
Files.copy(source.toPath(), dest.toPath());
}
catch (IOException ex) {
IO.exception(ex) ;
}
}
代码示例来源:origin: apache/jena
@Override
public void truncate(long length) {
try {
// http://bugs.sun.com/view_bug.do?bug_id=6191269
if ( length < file.position() )
file.position(length) ;
file.truncate(length) ;
}
catch (IOException e) {
IO.exception(e) ;
}
}
代码示例来源:origin: apache/jena
/** Open a file for output - may include adding gzip processing. */
static public OutputStream openOutputFile(String filename) {
try { return openOutputFileEx(filename) ; }
catch (IOException ex) { IO.exception(ex) ; return null ; }
}
代码示例来源:origin: apache/jena
@Override
protected ByteBuffer allocateBuffer(long size)
{
try { return file.channel().map(FileChannel.MapMode.READ_WRITE, 0, size) ; }
catch (IOException ex) { IO.exception(ex) ; return null ; }
}
}
代码示例来源:origin: apache/jena
@Override
public int read(ByteBuffer buffer)
{
try { return file.channel().read(buffer) ; }
catch (IOException e) { IO.exception(e) ; return -1 ; }
}
代码示例来源:origin: apache/jena
@Override
public int write(ByteBuffer buffer, long loc)
{
try { return file.channel().write(buffer, loc) ; }
catch (IOException e) { IO.exception(e) ; return -1 ; }
}
代码示例来源:origin: apache/jena
@Override
public boolean isEmpty()
{
try { return file.channel().size() == 0 ; }
catch (IOException e) { IO.exception(e) ; return false ; }
}
代码示例来源:origin: apache/jena
public void truncate(long length) {
if ( TRACKING )
log("truncate(%d)", length) ;
if ( length < 0 )
IO.exception(String.format("truncate: bad length : %d", length)) ;
checkOpen() ;
dataLength = Math.min(dataLength, length) ;
// clear above?
}
代码示例来源:origin: apache/jena
@Override
public void close() {
try {
reader.close() ;
}
catch (IOException ex) {
IO.exception(ex) ;
}
}
代码示例来源:origin: apache/jena
/** Write to a file */
public static void write(String filename, StoreParams params) {
try (OutputStream out = new FileOutputStream(filename);
OutputStream out2 = new BufferedOutputStream(out); ) {
JsonObject object = encodeToJson(params) ;
JSON.write(out2, object) ;
out2.write('\n') ;
}
catch (IOException ex) { IO.exception(ex); }
}
代码示例来源:origin: apache/jena
/** Create or fetch a {@link ProcessFileLock} for a Location */
public static ProcessFileLock lockForLocation(Location location) {
FileOps.ensureDir(location.getDirectoryPath());
String lockFilename = location.getPath(Names.TDB_LOCK_FILE);
Path path = Paths.get(lockFilename);
try {
path.toFile().createNewFile();
} catch(IOException ex) { IO.exception(ex); return null; }
return ProcessFileLock.create(lockFilename);
}
内容来源于网络,如有侵权,请联系作者删除!