public class ResourceAlignmentExtraField extends java.lang.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 ZipShort ID
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 short getAlignment()
public boolean allowMethodChange()
public ZipShort getHeaderId()
ZipExtraField
getHeaderId
in interface ZipExtraField
public ZipShort getLocalFileDataLength()
ZipExtraField
getLocalFileDataLength
in interface ZipExtraField
public ZipShort getCentralDirectoryLength()
ZipExtraField
getCentralDirectoryLength
in interface ZipExtraField
public byte[] getLocalFileDataData()
ZipExtraField
getLocalFileDataData
in interface ZipExtraField
public byte[] getCentralDirectoryData()
ZipExtraField
getCentralDirectoryData
in interface ZipExtraField
public void parseFromLocalFileData(byte[] buffer, int offset, int length) throws java.util.zip.ZipException
ZipExtraField
parseFromLocalFileData
in interface ZipExtraField
buffer
- the buffer to read data fromoffset
- offset into buffer to read datalength
- the length of datajava.util.zip.ZipException
- on errorpublic void parseFromCentralDirectoryData(byte[] buffer, int offset, int length) throws java.util.zip.ZipException
ZipExtraField
parseFromCentralDirectoryData
in interface ZipExtraField
buffer
- the buffer to read data fromoffset
- offset into buffer to read datalength
- the length of datajava.util.zip.ZipException
- on errorCopyright © 2010 - 2020 Adobe. All Rights Reserved