Class ZipEncodingHelper
java.lang.Object
org.apache.commons.compress.archivers.zip.ZipEncodingHelper
Static helper functions for robustly encoding file names in zip files.
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) static final String
name of the encoding UTF-8(package private) static final ZipEncoding
the encoding UTF-8 -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic ZipEncoding
getZipEncoding
(String name) Instantiates a zip encoding.(package private) static ByteBuffer
growBufferBy
(ByteBuffer buffer, int increment) (package private) static boolean
Returns whether a given encoding is UTF-8.
-
Field Details
-
UTF8
name of the encoding UTF-8- See Also:
-
UTF8_ZIP_ENCODING
the encoding UTF-8
-
-
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:
name
- The name of the zip encoding. Specifynull
for the platform's default encoding.- Returns:
- A zip encoding for the given encoding name.
-
isUTF8
Returns whether a given encoding is UTF-8. If the given name is null, then check the platform's default encoding.- Parameters:
charsetName
- If the given name is null, then check the platform's default encoding.
-
growBufferBy
-