in src/main/java/com/ecs/cicd/FileZipperHelper.java [22:40]
static void writeFileAsZipIfChanged(String appspec) throws IOException {
Path zipFile = Paths.get("asset/appspec.zip");
if (isChangedFromZip(appspec, zipFile)) return;
FileOutputStream fos = new FileOutputStream("asset/appspec.zip");
ZipOutputStream zipOut = new ZipOutputStream(fos);
StringInputStream sis = new StringInputStream(appspec);
ZipEntry zipEntry = new ZipEntry("appspec.yaml");
zipOut.putNextEntry(zipEntry);
byte[] bytes = new byte[1024];
int length;
while ((length = sis.read(bytes)) >= 0) {
zipOut.write(bytes, 0, length);
}
zipOut.close();
sis.close();
fos.close();
}