|
TrueZIP 6.8.2 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectde.schlichtherle.util.zip.ExtraField
abstract class ExtraField
Abstract base class for an Extra Field in a Local or Central Header of a ZIP archive. It defines the common properties of all Extra Fields and how to serialize/deserialize them to/from byte arrays.
This class is not thread-safe.
| Field Summary | |
|---|---|
private static Map |
registry
|
static int |
ZIP64_HEADER_ID
The Header ID of a ZIP64 Extended Information Extra Field. |
| Constructor Summary | |
|---|---|
ExtraField()
|
|
| Method Summary | |
|---|---|
static ExtraField |
create(int headerID)
A static factory method which creates a new Extra Field based on the given Header ID. |
(package private) byte[] |
getDataBlock()
Returns a protective copy of the Data Block. |
(package private) abstract int |
getDataSize()
Returns the Data Size of this Extra Field. |
abstract int |
getHeaderID()
Returns the Header ID (type) of this Extra Field. |
(package private) abstract void |
readFrom(byte[] data,
int off,
int size)
Initializes this Extra Field by deserializing a Data Block of size bytes from the
byte array data at the zero based offset off. |
static void |
register(Class c)
Registers a concrete implementation of this abstract base class for use with the static factory method create(int). |
(package private) abstract void |
writeTo(byte[] data,
int off)
Serializes a Data Block of getDataSize() bytes to the
byte array data at the zero based offset off. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int ZIP64_HEADER_ID
private static final Map registry
| Constructor Detail |
|---|
ExtraField()
| Method Detail |
|---|
public static void register(Class c)
create(int).
c - The implementation class of this abstract base class.
IllegalArgumentException - If c is null,
cannot get instantiated, is not a subclass of
ExtraField or its Header ID is out of range.
A more descriptive exception may be associated to it as its
cause.create(int)public static ExtraField create(int headerID)
readFrom(byte[], int, int).
headerID - An unsigned short integer (two bytes) which indicates
the type of the returned Extra Field.
null!
IllegalArgumentException - If headerID is out of
range.register(java.lang.Class)public abstract int getHeaderID()
abstract int getDataSize()
readFrom(byte[], int, int).
0 if unknown.getDataBlock()final byte[] getDataBlock()
null is never returned.
getDataSize()
abstract void readFrom(byte[] data,
int off,
int size)
size bytes from the
byte array data at the zero based offset off.
Upon return, this Extra Field shall not access data
subsequently and getDataSize() must equal size.
data - The byte array to read the Data Block from.off - The zero based offset in the byte array where the first byte
of the Data Block is read from.size - The length of the Data Block in bytes.
IndexOutOfBoundsException - If the byte array
data does not hold at least size
bytes at the zero based offset off.
RuntimeException - If size is illegal or the
deserialized Data Block contains illegal data.getDataSize()
abstract void writeTo(byte[] data,
int off)
getDataSize() bytes to the
byte array data at the zero based offset off.
Upon return, this Extra Field shall not access data
subsequently.
data - The byte array to write the Data Block to.off - The zero based offset in the byte array where the first byte
of the Data Block is written to.
IndexOutOfBoundsException - If the byte array
data does not hold at least getDataSize()
bytes at the zero based offset off.getDataSize()
|
TrueZIP 6.8.2 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||