static String saveLibrary ( final File dir , final String libraryName ) throws IOException { String libraryFileName = "lib" + libraryName ; URL libraryResource = findLibraryResource ( libraryFileName ) ; String basename = FilenameUtils . getName ( libraryResource . getPath ( ) ) ; File file = new File ( dir , basename ) ; file . deleteOnExit ( ) ; try ( InputStream in = libraryResource . openStream ( ) ; OutputStream out = new FileOutputStream ( file ) ) { IOUtils . copy ( in , out ) ; } LOG . trace ( "Library \"{}\" copied to \"{}\"" , libraryName , file . getAbsolutePath ( ) ) ; return file . getAbsolutePath ( ) ; }
Save the shared library in the given temporary directory .