org.apache.tools.zip

Class Zip64ExtendedInformationExtraField

  • java.lang.Object
    • org.apache.tools.zip.Zip64ExtendedInformationExtraField
    • Constructor Detail

      • Zip64ExtendedInformationExtraField

        public Zip64ExtendedInformationExtraField()
        This constructor should only be used by the code that reads archives inside of Ant.
      • Zip64ExtendedInformationExtraField

        public Zip64ExtendedInformationExtraField(ZipEightByteInteger size,
                                                  ZipEightByteInteger compressedSize)
        Creates an extra field based on the original and compressed size.
        Parameters:
        size - the entry's original size
        compressedSize - the entry's compressed size
        Throws:
        java.lang.IllegalArgumentException - if size or compressedSize is null
      • Zip64ExtendedInformationExtraField

        public Zip64ExtendedInformationExtraField(ZipEightByteInteger size,
                                                  ZipEightByteInteger compressedSize,
                                                  ZipEightByteInteger relativeHeaderOffset,
                                                  ZipLong diskStart)
        Creates an extra field based on all four possible values.
        Parameters:
        size - the entry's original size
        compressedSize - the entry's compressed size
        relativeHeaderOffset - ZipEightByteInteger
        diskStart - ZipLong
        Throws:
        java.lang.IllegalArgumentException - if size or compressedSize is null
    • Method Detail

      • getLocalFileDataLength

        public ZipShort getLocalFileDataLength()
        Length of the extra field in the local file data - without Header-ID or length specifier.
        Specified by:
        getLocalFileDataLength in interface ZipExtraField
        Returns:
        the length of the field in the local file data
      • getCentralDirectoryLength

        public ZipShort getCentralDirectoryLength()
        Length of the extra field in the central directory - without Header-ID or length specifier.
        Specified by:
        getCentralDirectoryLength in interface ZipExtraField
        Returns:
        the length of the field in the central directory
      • getLocalFileDataData

        public byte[] getLocalFileDataData()
        The actual data to put into local file data - without Header-ID or length specifier.
        Specified by:
        getLocalFileDataData in interface ZipExtraField
        Returns:
        the data
      • getCentralDirectoryData

        public byte[] getCentralDirectoryData()
        The actual data to put into central directory - without Header-ID or length specifier.
        Specified by:
        getCentralDirectoryData in interface ZipExtraField
        Returns:
        the data
      • parseFromLocalFileData

        public void parseFromLocalFileData(byte[] buffer,
                                           int offset,
                                           int length)
                                    throws java.util.zip.ZipException
        Populate data from this array as if it was in local file data.
        Specified by:
        parseFromLocalFileData in interface ZipExtraField
        Parameters:
        buffer - an array of bytes
        offset - the start offset
        length - the number of bytes in the array from offset
        Throws:
        java.util.zip.ZipException - on error
      • parseFromCentralDirectoryData

        public void parseFromCentralDirectoryData(byte[] buffer,
                                                  int offset,
                                                  int length)
                                           throws java.util.zip.ZipException
        Populate data from this array as if it was in central directory data.
        Specified by:
        parseFromCentralDirectoryData in interface CentralDirectoryParsingZipExtraField
        Parameters:
        buffer - an array of bytes
        offset - the start offset
        length - the number of bytes in the array from offset
        Throws:
        java.util.zip.ZipException - on error
      • reparseCentralDirectoryData

        public void reparseCentralDirectoryData(boolean hasUncompressedSize,
                                                boolean hasCompressedSize,
                                                boolean hasRelativeHeaderOffset,
                                                boolean hasDiskStart)
                                         throws java.util.zip.ZipException
        Parses the raw bytes read from the central directory extra field with knowledge which fields are expected to be there.

        All four fields inside the zip64 extended information extra field are optional and must only be present if their corresponding entry inside the central directory contains the correct magic value.

        Parameters:
        hasUncompressedSize - boolean
        hasCompressedSize - boolean
        hasRelativeHeaderOffset - boolean
        hasDiskStart - boolean
        Throws:
        java.util.zip.ZipException - if expected length of central directory data is incorrect
      • getSize

        public ZipEightByteInteger getSize()
        The uncompressed size stored in this extra field.
        Returns:
        ZipEightByteInteger
      • setSize

        public void setSize(ZipEightByteInteger size)
        The uncompressed size stored in this extra field.
        Parameters:
        size - ZipEightByteInteger
      • getCompressedSize

        public ZipEightByteInteger getCompressedSize()
        The compressed size stored in this extra field.
        Returns:
        ZipEightByteInteger
      • setCompressedSize

        public void setCompressedSize(ZipEightByteInteger compressedSize)
        The uncompressed size stored in this extra field.
        Parameters:
        compressedSize - ZipEightByteInteger
      • getRelativeHeaderOffset

        public ZipEightByteInteger getRelativeHeaderOffset()
        The relative header offset stored in this extra field.
        Returns:
        ZipEightByteInteger
      • setRelativeHeaderOffset

        public void setRelativeHeaderOffset(ZipEightByteInteger rho)
        The relative header offset stored in this extra field.
        Parameters:
        rho - ZipEightByteInteger
      • getDiskStartNumber

        public ZipLong getDiskStartNumber()
        The disk start number stored in this extra field.
        Returns:
        ZipLong
      • setDiskStartNumber

        public void setDiskStartNumber(ZipLong ds)
        The disk start number stored in this extra field.
        Parameters:
        ds - ZipLong