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

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

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

FileUtils.getScratchDirectory介绍

[英]Answer a File naming a freshly-created directory in the temporary directory. This directory should be deleted on exit. TODO handle threading issues, mkdir failure, and better cleanup
[中]回答在临时目录中命名新创建目录的文件。退出时应删除此目录。TODO处理线程问题、mkdir故障和更好的清理

代码示例

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

/**
 Answer a File naming a freshly-created directory in the temporary directory. This
 directory should be deleted on exit.
 TODO handle threading issues, mkdir failure, and better cleanup
 
 @param prefix the prefix for the directory name
 @return a File naming the new directory
 */
public static File getScratchDirectory( String prefix )
{
  File result = new File( getTempDirectory(), prefix + randomNumber() );
  if (result.exists()) return getScratchDirectory( prefix );
  if (result.mkdir() == false) throw new JenaException( "mkdir failed on " + result );
  result.deleteOnExit();
  return result;   
}

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

/**
 Answer a File naming a freshly-created directory in the temporary directory. This
 directory should be deleted on exit.
 TODO handle threading issues, mkdir failure, and better cleanup
 
 @param prefix the prefix for the directory name
 @return a File naming the new directory
 */
public static File getScratchDirectory( String prefix )
{
  File result = new File( getTempDirectory(), prefix + randomNumber() );
  if (result.exists()) return getScratchDirectory( prefix );
  if (result.mkdir() == false) throw new JenaException( "mkdir failed on " + result );
  result.deleteOnExit();
  return result;   
}

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

File tmpDir = FileUtils.getScratchDirectory( "schemagen" );
File srcFile = new File( tmpDir, className + ".java" );
try ( FileWriter out = new FileWriter( srcFile ) ) {

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

File tmpDir = FileUtils.getScratchDirectory( "schemagen" );
File srcFile = new File( tmpDir, className + ".java" );
try ( FileWriter out = new FileWriter( srcFile ) ) {

相关文章