@NotThreadSafe @DefaultAnnotation(value=edu.umd.cs.findbugs.annotations.NonNull.class) abstract class ExtraField extends Object
| Modifier and Type | Field and Description |
|---|---|
private static Map<Integer,Class<? extends ExtraField>> |
registry |
(package private) static int |
WINZIP_AES_ID
The Header ID for a WinZip AES Extra Field.
|
(package private) static int |
ZIP64_HEADER_ID
The Header ID for a ZIP64 Extended Information Extra Field.
|
| Constructor and Description |
|---|
ExtraField() |
| Modifier and Type | Method and Description |
|---|---|
(package private) 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.
|
(package private) 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. |
(package private) static void |
register(Class<? extends ExtraField> 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)
|
private static final Map<Integer,Class<? extends ExtraField>> registry
static final int WINZIP_AES_ID
static final int ZIP64_HEADER_ID
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.IllegalArgumentException - If headerID is out of
range.register(java.lang.Class<? extends de.schlichtherle.truezip.zip.ExtraField>)final byte[] getDataBlock()
getDataSize()abstract int getDataSize()
readFrom(byte[], int, int).0 if unknown.getDataBlock()abstract int getHeaderId()
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()static void register(Class<? extends ExtraField> c)
create(int).c - the implementation class of this abstract base class.IllegalArgumentException - if c 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)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()Copyright © 2004-2011 Schlichtherle IT Services. All Rights Reserved.