zip

Compresses this String using GZIP encoding.

Return

a GZIP-compressed byte array, or EMPTY_BYTE_ARRAY if this string is empty.


Compresses this ByteArray using GZIP encoding.

Equivalent to String.zip but operates on raw bytes, avoiding a redundant UTF-8 re-encoding when the caller already holds the content as a byte array. For the same content, bytes.zip() produces identical output to string.zip() when bytes == string.toByteArray(StandardCharsets.UTF_8).

Return

a GZIP-compressed byte array, or EMPTY_BYTE_ARRAY if this array is empty.