Class ZipEncodingHelper
java.lang.Object
org.apache.commons.compress.archivers.zip.ZipEncodingHelper
Static helper functions for robustly encoding file names in ZIP files.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic ZipEncoding
getZipEncoding
(String name) Instantiates a ZIP encoding.static ZipEncoding
getZipEncoding
(Charset charset) Instantiates a ZIP encoding.
-
Constructor Details
-
ZipEncodingHelper
public ZipEncodingHelper()
-
-
Method Details
-
getZipEncoding
Instantiates a ZIP encoding. An NIO based character set encoder/decoder will be returned. As a special case, if the character set is UTF-8, the NIO encoder will be configured replace malformed and unmappable characters with '?'. This matches existing behavior from the older fallback encoder.If the requested character set cannot be found, the platform default will be used instead.
- Parameters:
charset
- The charset of the ZIP encoding. Specifynull
for the platform's default encoding.- Returns:
- A ZIP encoding for the given encoding name.
- Since:
- 1.26.0
-
getZipEncoding
Instantiates a ZIP encoding. An NIO based character set encoder/decoder will be returned. As a special case, if the character set is UTF-8, the NIO encoder will be configured replace malformed and unmappable characters with '?'. This matches existing behavior from the older fallback encoder.If the requested character set cannot be found, the platform default will be used instead.
- Parameters:
name
- The name of the ZIP encoding. Specifynull
for the platform's default encoding.- Returns:
- A ZIP encoding for the given encoding name.
-