Class ExtraFieldUtils
- java.lang.Object
-
- org.apache.commons.compress.archivers.zip.ExtraFieldUtils
-
public class ExtraFieldUtils extends java.lang.Object
ZipExtraField related methods- Version:
- $Revision: 155439 $
- Author:
- Stefan Bodewig
-
-
Field Summary
Fields Modifier and Type Field Description private static java.util.Hashtable
c_implementations
Static registry of known extra fields.
-
Constructor Summary
Constructors Constructor Description ExtraFieldUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static ZipExtraField
createExtraField(ZipShort headerID)
Create an instance of the approriate ExtraField, falls back toUnrecognizedExtraField
.static byte[]
mergeCentralDirectoryData(ZipExtraField[] data)
Merges the central directory fields of the given ZipExtraFields.static byte[]
mergeLocalFileDataData(ZipExtraField[] data)
Merges the local file data fields of the given ZipExtraFields.static ZipExtraField[]
parse(byte[] data)
Split the array into ExtraFields and populate them with the give data.static void
register(java.lang.Class clazz)
Register a ZipExtraField implementation.
-
-
-
Method Detail
-
createExtraField
public static ZipExtraField createExtraField(ZipShort headerID) throws java.lang.InstantiationException, java.lang.IllegalAccessException
Create an instance of the approriate ExtraField, falls back toUnrecognizedExtraField
. Throws java.lang.IllegalAccessException if cant create implementation.- Parameters:
headerID
- the header ID- Returns:
- the extra field implementation
- Throws:
java.lang.InstantiationException
- if cant create implementationjava.lang.IllegalAccessException
- if cant create implementation- Since:
- 1.1
-
mergeCentralDirectoryData
public static byte[] mergeCentralDirectoryData(ZipExtraField[] data)
Merges the central directory fields of the given ZipExtraFields.- Parameters:
data
- the central directory data- Returns:
- the merged data
- Since:
- 1.1
-
mergeLocalFileDataData
public static byte[] mergeLocalFileDataData(ZipExtraField[] data)
Merges the local file data fields of the given ZipExtraFields.- Parameters:
data
- the data- Returns:
- the merged data
- Since:
- 1.1
-
parse
public static ZipExtraField[] parse(byte[] data) throws java.util.zip.ZipException
Split the array into ExtraFields and populate them with the give data.- Parameters:
data
- the data to parse- Returns:
- the parsed fields
- Throws:
java.util.zip.ZipException
- on error- Since:
- 1.1
-
register
public static void register(java.lang.Class clazz)
Register a ZipExtraField implementation.The given class must have a no-arg constructor and implement the
ZipExtraField interface
.- Parameters:
clazz
- The Class for particular implementation- Since:
- 1.1
-
-