public static byte[] zip(final List<ZipItem> source) {
        byte[] result = null;
        try (ByteArrayOutputStream byteOut = new ByteArrayOutputStream(); ZipOutputStream zipOut = new ZipOutputStream(
                byteOut)) {
            for (ZipItem item : source) {
                zipOut.putNextEntry(new ZipEntry(item.getItemName()));
                zipOut.write(item.getItemData().getBytes(StandardCharsets.UTF_8));
            }
            zipOut.flush();
            zipOut.finish();
            result = byteOut.toByteArray();
        } catch (IOException e) {
            LOG.error("an error occurred while compressing data.", e);
        }
        return result;
    }
zip method.

@param source zip source
@return byte array
shenyu-admin/src/main/java/org/apache/shenyu/admin/utils/ZipUtil.java