/** create a temporary file that will be deleted on exit, and do something sensible with any IO exceptions - namely, throw them up wrapped in a JenaException. @param prefix the prefix for File.createTempFile @param suffix the suffix for File.createTempFile @return the temporary File */ public static File tempFileName( String prefix, String suffix ) { File result = new File( getTempDirectory(), prefix + randomNumber() + suffix ); if (result.exists()) return tempFileName( prefix, suffix ); result.deleteOnExit(); return result; }
/** create a temporary file that will be deleted on exit, and do something sensible with any IO exceptions - namely, throw them up wrapped in a JenaException. @param prefix the prefix for File.createTempFile @param suffix the suffix for File.createTempFile @return the temporary File */ public static File tempFileName( String prefix, String suffix ) { File result = new File( getTempDirectory(), prefix + randomNumber() + suffix ); if (result.exists()) return tempFileName( prefix, suffix ); result.deleteOnExit(); return result; }
public void testWithContent() throws IOException { File f = FileUtils.tempFileName( "assembler-acceptance-", ".n3" ); Model data = model( "a P b; b Q c" ); try ( FileOutputStream fs = new FileOutputStream( f ) ) { data.write( fs, "N3" ); } Resource root = resourceInModel( "x rdf:type ja:MemoryModel; x ja:content y; y ja:externalContent file:" + f.getAbsolutePath() ); Model m = Assembler.general.openModel( root ); assertIsoModels( data, m ); } }
public void testWithContent() throws IOException { File f = FileUtils.tempFileName( "assembler-acceptance-", ".n3" ); Model data = model( "a P b; b Q c" ); try ( FileOutputStream fs = new FileOutputStream( f ) ) { data.write( fs, "N3" ); } Resource root = resourceInModel( "x rdf:type ja:MemoryModel; x ja:content y; y ja:externalContent file:" + f.getAbsolutePath() ); Model m = Assembler.general.openModel( root ); assertIsoModels( data, m ); } }