Class ResourceAlignmentExtraField

  • All Implemented Interfaces:
    ZipExtraField

    public class ResourceAlignmentExtraField
    extends java.lang.Object
    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.

    Since:
    1.14
    See Also:
    "https://developer.android.com/studio/command-line/zipalign.html", ZipArchiveEntry.setAlignment(int)
    • Constructor Detail

      • ResourceAlignmentExtraField

        public ResourceAlignmentExtraField​(int alignment)
        Constructs a new instance.
        Parameters:
        alignment - A positive alignment less than Short.MAX_VALUE.
      • ResourceAlignmentExtraField

        public ResourceAlignmentExtraField​(int alignment,
                                           boolean allowMethodChange)
        Constructs a new instance.
        Parameters:
        alignment - A positive alignment less than Short.MAX_VALUE.
        allowMethodChange - whether a method change is allowed when re-compressing the ZIP file.
      • ResourceAlignmentExtraField

        public ResourceAlignmentExtraField​(int alignment,
                                           boolean allowMethodChange,
                                           int padding)
        Constructs a new instance.
        Parameters:
        alignment - A positive alignment less than Short.MAX_VALUE.
        allowMethodChange - whether a method change is allowed when re-compressing the ZIP file.
        padding - padding.