Package 

Class Zip64ExtendedInformationExtraField

  • All Implemented Interfaces:
    org.readium.r2.shared.util.zip.compress.archivers.zip.ZipExtraField

    
    public class Zip64ExtendedInformationExtraField
     implements ZipExtraField
                        

    Holds size and other extended information for entries that use Zip64 features.

    Currently Commons Compress doesn't support encrypting the central directory so the note in APPNOTE.TXT about masking doesn't apply.

    The implementation relies on data being read from the local file header and assumes that both size values are always present.

    • Constructor Detail

      • Zip64ExtendedInformationExtraField

        Zip64ExtendedInformationExtraField()
        This constructor should only be used by the code that readsarchives inside of Commons Compress.
      • Zip64ExtendedInformationExtraField

        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
      • Zip64ExtendedInformationExtraField

        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 - the entry's offset
        diskStart - the disk start
    • Method Detail

      • setSize

         void setSize(ZipEightByteInteger size)

        The uncompressed size stored in this extra field.

        Parameters:
        size - The uncompressed size stored in this extra field.
      • setCompressedSize

         void setCompressedSize(ZipEightByteInteger compressedSize)

        The uncompressed size stored in this extra field.

        Parameters:
        compressedSize - The uncompressed size stored in this extra field.
      • getCentralDirectoryData

         Array<byte> getCentralDirectoryData()

        The actual data to put into central directory - without Header-ID orlength specifier.

      • getLocalFileDataData

         Array<byte> getLocalFileDataData()

        The actual data to put into local file data - without Header-IDor 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 from
        offset - offset into buffer to read data
        length - 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 from
        offset - offset into buffer to read data
        length - the length of data
      • reparseCentralDirectoryData

         void reparseCentralDirectoryData(boolean hasUncompressedSize, boolean hasCompressedSize, boolean hasRelativeHeaderOffset, boolean hasDiskStart)

        Parses the raw bytes read from the central directory extrafield with knowledge which fields are expected to be there.

        All four fields inside the zip64 extended information extrafield are optional and must only be present if their correspondingentry inside the central directory contains the correct magicvalue.

        Parameters:
        hasUncompressedSize - flag to read from central directory
        hasCompressedSize - flag to read from central directory
        hasRelativeHeaderOffset - flag to read from central directory
        hasDiskStart - flag to read from central directory
      • setDiskStartNumber

         void setDiskStartNumber(ZipLong ds)

        The disk start number stored in this extra field.

        Parameters:
        ds - The disk start number stored in this extra field.