public abstract class ZipEncodingHelper
extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
private static class |
ZipEncodingHelper.SimpleEncodingHolder
A class, which holds the high characters of a simple encoding
and lazily instantiates a Simple8BitZipEncoding instance in a
thread-safe manner.
|
| Modifier and Type | Field and Description |
|---|---|
private static byte[] |
HEX_DIGITS
The hexadecimal digits
0,...,9,A,...,F encoded as
ASCII bytes. |
private static java.util.Map<java.lang.String,ZipEncodingHelper.SimpleEncodingHolder> |
simpleEncodings |
(package private) static java.lang.String |
UTF8
name of the encoding UTF-8
|
(package private) static ZipEncoding |
UTF8_ZIP_ENCODING
name of the encoding UTF-8
|
| Constructor and Description |
|---|
ZipEncodingHelper() |
| Modifier and Type | Method and Description |
|---|---|
(package private) static void |
appendSurrogate(java.nio.ByteBuffer bb,
char c)
Append
%Uxxxx to the given byte buffer. |
static ZipEncoding |
getZipEncoding(java.lang.String name)
Instantiates a zip encoding.
|
(package private) static java.nio.ByteBuffer |
growBuffer(java.nio.ByteBuffer b,
int newCapacity)
Grow a byte buffer, so it has a minimal capacity or at least
the double capacity of the original buffer
|
(package private) static boolean |
isUTF8(java.lang.String charsetName)
Returns whether a given encoding is UTF-8.
|
private static final java.util.Map<java.lang.String,ZipEncodingHelper.SimpleEncodingHolder> simpleEncodings
private static final byte[] HEX_DIGITS
0,...,9,A,...,F encoded as
ASCII bytes.static final java.lang.String UTF8
static final ZipEncoding UTF8_ZIP_ENCODING
static java.nio.ByteBuffer growBuffer(java.nio.ByteBuffer b,
int newCapacity)
b - The original buffer.newCapacity - The minimal requested new capacity.r with
r.capacity() = max(b.capacity()*2,newCapacity) and
all the data contained in b copied to the beginning
of r.static void appendSurrogate(java.nio.ByteBuffer bb,
char c)
%Uxxxx to the given byte buffer.
The caller must assure, that bb.remaining()>=6.bb - The byte buffer to write to.c - The character to write.public static ZipEncoding getZipEncoding(java.lang.String name)
name - The name of the zip encoding. Specify null for
the platform's default encoding.static boolean isUTF8(java.lang.String charsetName)
charsetName - If the given name is null, then check the platform's default encoding.