public class ResourceAlignmentExtraField extends Object implements ZipExtraField
The padding content of the padding is ignored and not retained when reading a padding field.
This enables Commons Compress to create "aligned" archives
similar to Android's zipalign command line tool.
ZipArchiveEntry.setAlignment(int)| Modifier and Type | Field and Description |
|---|---|
static int |
BASE_SIZE |
static ZipShort |
ID
Extra field id used for storing alignment and padding.
|
EXTRAFIELD_HEADER_SIZE| Constructor and Description |
|---|
ResourceAlignmentExtraField() |
ResourceAlignmentExtraField(int alignment) |
ResourceAlignmentExtraField(int alignment,
boolean allowMethodChange) |
ResourceAlignmentExtraField(int alignment,
boolean allowMethodChange,
int padding) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
allowMethodChange()
Indicates whether method change is allowed when re-compressing the ZIP file.
|
short |
getAlignment()
Gets requested alignment.
|
byte[] |
getCentralDirectoryData()
The actual data to put into central directory - without Header-ID or
length specifier.
|
ZipShort |
getCentralDirectoryLength()
Length of the extra field in the central directory - without
Header-ID or length specifier.
|
ZipShort |
getHeaderId()
The Header-ID.
|
byte[] |
getLocalFileDataData()
The actual data to put into local file data - without Header-ID
or length specifier.
|
ZipShort |
getLocalFileDataLength()
Length of the extra field in the local file data - without
Header-ID or length specifier.
|
void |
parseFromCentralDirectoryData(byte[] buffer,
int offset,
int length)
Populate data from this array as if it was in central directory data.
|
void |
parseFromLocalFileData(byte[] buffer,
int offset,
int length)
Populate data from this array as if it was in local file data.
|
public static final int BASE_SIZE
public ResourceAlignmentExtraField()
public ResourceAlignmentExtraField(int alignment)
public ResourceAlignmentExtraField(int alignment, boolean allowMethodChange)
public ResourceAlignmentExtraField(int alignment, boolean allowMethodChange, int padding)
public boolean allowMethodChange()
public short getAlignment()
public byte[] getCentralDirectoryData()
ZipExtraFieldgetCentralDirectoryData in interface ZipExtraFieldpublic ZipShort getCentralDirectoryLength()
ZipExtraFieldgetCentralDirectoryLength in interface ZipExtraFieldpublic ZipShort getHeaderId()
ZipExtraFieldgetHeaderId in interface ZipExtraFieldpublic byte[] getLocalFileDataData()
ZipExtraFieldgetLocalFileDataData in interface ZipExtraFieldpublic ZipShort getLocalFileDataLength()
ZipExtraFieldgetLocalFileDataLength in interface ZipExtraFieldpublic void parseFromCentralDirectoryData(byte[] buffer, int offset, int length) throws ZipException
ZipExtraFieldparseFromCentralDirectoryData in interface ZipExtraFieldbuffer - the buffer to read data fromoffset - offset into buffer to read datalength - the length of dataZipException - on errorpublic void parseFromLocalFileData(byte[] buffer, int offset, int length) throws ZipException
ZipExtraFieldparseFromLocalFileData in interface ZipExtraFieldbuffer - the buffer to read data fromoffset - offset into buffer to read datalength - the length of dataZipException - on errorCopyright © 2002–2022 The Apache Software Foundation. All rights reserved.