-
- All Implemented Interfaces:
-
org.readium.r2.shared.util.zip.compress.archivers.zip.ZipExtraField
public class ResourceAlignmentExtraField implements ZipExtraField
An extra field who's sole purpose is to align and pad the local file header so that the entry's data starts at a certain position.
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.
-
-
Constructor Summary
Constructors Constructor Description ResourceAlignmentExtraField()ResourceAlignmentExtraField(int alignment)ResourceAlignmentExtraField(int alignment, boolean allowMethodChange)ResourceAlignmentExtraField(int alignment, boolean allowMethodChange, int padding)
-
Method Summary
Modifier and Type Method Description shortgetAlignment()Gets requested alignment. booleanallowMethodChange()Indicates whether method change is allowed when re-compressing the ZIP file. Array<byte>getCentralDirectoryData()The actual data to put into central directory - without Header-ID orlength specifier. ZipShortgetCentralDirectoryLength()Length of the extra field in the central directory - withoutHeader-ID or length specifier. ZipShortgetHeaderId()The Header-ID. Array<byte>getLocalFileDataData()The actual data to put into local file data - without Header-IDor length specifier. ZipShortgetLocalFileDataLength()Length of the extra field in the local file data - withoutHeader-ID or length specifier. voidparseFromCentralDirectoryData(Array<byte> buffer, int offset, int length)Populate data from this array as if it was in central directory data. voidparseFromLocalFileData(Array<byte> buffer, int offset, int length)Populate data from this array as if it was in local file data. -
-
Constructor Detail
-
ResourceAlignmentExtraField
ResourceAlignmentExtraField()
-
ResourceAlignmentExtraField
ResourceAlignmentExtraField(int alignment)
-
ResourceAlignmentExtraField
ResourceAlignmentExtraField(int alignment, boolean allowMethodChange)
-
ResourceAlignmentExtraField
ResourceAlignmentExtraField(int alignment, boolean allowMethodChange, int padding)
-
-
Method Detail
-
getAlignment
short getAlignment()
Gets requested alignment.
-
allowMethodChange
boolean allowMethodChange()
Indicates whether method change is allowed when re-compressing the ZIP file.
-
getCentralDirectoryData
Array<byte> getCentralDirectoryData()
The actual data to put into central directory - without Header-ID orlength specifier.
-
getCentralDirectoryLength
ZipShort getCentralDirectoryLength()
Length of the extra field in the central directory - withoutHeader-ID or length specifier.
-
getHeaderId
ZipShort getHeaderId()
The Header-ID.
-
getLocalFileDataData
Array<byte> getLocalFileDataData()
The actual data to put into local file data - without Header-IDor length specifier.
-
getLocalFileDataLength
ZipShort getLocalFileDataLength()
Length of the extra field in the local file data - withoutHeader-ID or length specifier.
-
parseFromCentralDirectoryData
void parseFromCentralDirectoryData(Array<byte> buffer, int offset, int length)
Populate data from this array as if it was in central directory data.
- Parameters:
buffer- the buffer to read data fromoffset- offset into buffer to read datalength- the length of data
-
parseFromLocalFileData
void parseFromLocalFileData(Array<byte> buffer, int offset, int length)
Populate data from this array as if it was in local file data.
- Parameters:
buffer- the buffer to read data fromoffset- offset into buffer to read datalength- the length of data
-
-
-
-