@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 |
static int |
ZIP64_HEADER_ID
The Header ID of a ZIP64 Extended Information Extra Field.
|
| Constructor and Description |
|---|
ExtraField() |
| Modifier and Type | Method and Description |
|---|---|
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<? 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)
|
public static final int ZIP64_HEADER_ID
private static final Map<Integer,Class<? extends ExtraField>> registry
public static void register(Class<? extends ExtraField> c)
create(int).c - the implementation class of this abstract base class.NullPointerException - if c is null.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)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<? extends de.schlichtherle.truezip.zip.ExtraField>)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()Copyright © 2005-2011 Schlichtherle IT Services. All Rights Reserved.