private static File extract ( JarFile jar , JarEntry entry ) throws IOException { // expand to temp dir and add to list File tempFile = File . createTempFile ( "liquibase.tmp" , null ) ; // read from jar and write to the tempJar file try ( BufferedInputStream inStream = new BufferedInputStream ( jar . getInputStream ( entry ) ) ; BufferedOutputStream outStream = new BufferedOutputStream ( new FileOutputStream ( tempFile ) ) ) { int status ; while ( ( status = inStream . read ( ) ) != - 1 ) { outStream . write ( status ) ; } } return tempFile ; }
Extract a single object from a JAR file into a temporary file .