Charset to encode names.
This implementation works for all cases under java-1.5 or later. However, in java-1.4, some charsets don't have a java.nio implementation, most notably the default ZIP encoding Cp437.
The methods of this class are reentrant.
| Access | Constructor and Description |
|---|---|
| public | NioZipEncoding(final Charset
The NIO charset to wrap. charset)Construct an NIO based zip encoding, which wraps the given charset. |
| Modifier and Type | Method and Description |
|---|---|
| public boolean | canEncode(final String
A filename or ZIP comment. name)Implements org. |
| public String | decode(final byte[]
The byte values to decode. data)Implements org. |
| public ByteBuffer | encode(final String
A filename or ZIP comment. name)Implements org. |
| charset | back to summary |
|---|---|
| private final Charset charset | |
| NioZipEncoding | back to summary |
|---|---|
| public NioZipEncoding(final Charset charset) Construct an NIO based zip encoding, which wraps the given charset.
| |
| canEncode | back to summary |
|---|---|
| public boolean canEncode(final String name) Implements org. Doc from org. Check, whether the given string may be losslessly encoded using this encoding.
| |
| decode | back to summary |
|---|---|
| public String decode(final byte[] data) throws IOException Implements org.
| |
| encode | back to summary |
|---|---|
| public ByteBuffer encode(final String name) Implements org. Doc from org. Encode a filename or a comment to a byte array suitable for storing it to a serialized zip entry. Examples for CP 437 (in pseudo-notation, right hand side is C-style notation):
encode("€_for_Dollar.txt") = "%U20AC_for_Dollar.txt"
encode("Ölfässer.txt") = "\231lf\204sser.txt"
| |