public static void replaceInZip ( String zipFile , String data , String encoding ) throws IOException { if ( ! isFileInZip ( zipFile ) ) { throw new IOException ( "Parameter should specify a file inside a ZIP file, but had: " + zipFile ) ; } File zip = new File ( zipFile . substring ( 0 , zipFile . indexOf ( ZIP_DELIMITER ) ) ) ; String zipOut = zipFile . substring ( zipFile . indexOf ( ZIP_DELIMITER ) + 1 ) ; logger . info ( "Updating containing Zip " + zip + " to " + zipOut ) ; // replace in zip ZipUtils . replaceInZip ( zip , zipOut , data , encoding ) ; }
Replace the file denoted by the zipFile with the provided data . The zipFile specifies both the zip and the file inside the zip using ! as separator .