public File build ( ) throws IOException { if ( entries . isEmpty ( ) ) { throw new EmptyZipException ( ) ; } String fileName = "import_configuration" + System . currentTimeMillis ( ) + ".zip" ; File result = new File ( TEMP_DIR . toFile ( ) , fileName ) ; try ( ZipOutputStream zip = new ZipOutputStream ( Files . newOutputStream ( result . toPath ( ) , StandardOpenOption . CREATE_NEW ) ) ) { customization . init ( entries . values ( ) , this :: streamFor ) ; for ( Entry < Object , String > entry : entries . entrySet ( ) ) { try ( InputStream input = toInputStream ( entry . getKey ( ) ) ) { addEntry ( ExtraZipEntry . of ( entry . getValue ( ) , customization . customize ( entry . getValue ( ) , input ) ) , zip ) ; } } customization . extraEntries ( ) . forEach ( entry -> addEntry ( entry , zip ) ) ; zip . closeEntry ( ) ; } return result ; }
Build a ZIP file containing the added entries .