/** 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; }
/** 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; }
File tmpDir = FileUtils.getScratchDirectory( "schemagen" ); File srcFile = new File( tmpDir, className + ".java" ); try ( FileWriter out = new FileWriter( srcFile ) ) {
File tmpDir = FileUtils.getScratchDirectory( "schemagen" ); File srcFile = new File( tmpDir, className + ".java" ); try ( FileWriter out = new FileWriter( srcFile ) ) {