public URL writeToTempFile ( ) throws IOException { final File tempConfigFile = File . createTempFile ( "brikar-tempconfig-" , ".properties" ) ; tempConfigFile . deleteOnExit ( ) ; // store properties final Properties props = new Properties ( ) ; props . putAll ( properties ) ; try ( final FileOutputStream fileOutputStream = new FileOutputStream ( tempConfigFile ) ) { props . store ( fileOutputStream , "[brikar-maintenance] TempConfiguration - Autogenerated properties" ) ; } return tempConfigFile . toURI ( ) . toURL ( ) ; }
Writes properties to the temporary file that will be deleted on process exit and returns file URL as a result .