Package java.util.zip
Class Zip64
- java.lang.Object
-
- java.util.zip.Zip64
-
public class Zip64 extends Object
-
-
Field Summary
Fields Modifier and Type Field Description static longMAX_ZIP_ENTRY_AND_ARCHIVE_SIZEThe maximum supported entry / archive size for standard (non zip64) entries and archives.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidinsertZip64ExtendedInfoToExtras(ZipEntry ze)Appends a zip64 extended info record to the extras contained inze.static java.util.zip.ZipFile.EocdRecordparseZip64EocdRecord(RandomAccessFile raf, long eocdRecordOffset, int commentLength)static longparseZip64EocdRecordLocator(RandomAccessFile raf, long eocdOffset)Parses the zip64 end of central directory record locator.static booleanparseZip64ExtendedInfo(ZipEntry ze, boolean fromCentralDirectory)Parse the zip64 extended info record from the extras present inze.static voidrefreshZip64ExtendedInfo(ZipEntry ze)Copy the size, compressed size and local header offset fields fromzeto insideze's extended info record.static voidwriteZip64EocdRecordAndLocator(ByteArrayOutputStream baos, long numEntries, long offset, long cDirSize)
-
-
-
Field Detail
-
MAX_ZIP_ENTRY_AND_ARCHIVE_SIZE
public static final long MAX_ZIP_ENTRY_AND_ARCHIVE_SIZE
The maximum supported entry / archive size for standard (non zip64) entries and archives.- See Also:
- Constant Field Values
-
-
Method Detail
-
parseZip64EocdRecordLocator
public static long parseZip64EocdRecordLocator(RandomAccessFile raf, long eocdOffset) throws IOException
Parses the zip64 end of central directory record locator. The locator must be placed immediately before the end of central directory (eocd) record starting ateocdOffset. The position of the file cursor forrafafter a call to this method is undefined an callers must reposition it after each call to this method.- Throws:
IOException
-
parseZip64EocdRecord
public static java.util.zip.ZipFile.EocdRecord parseZip64EocdRecord(RandomAccessFile raf, long eocdRecordOffset, int commentLength) throws IOException
- Throws:
IOException
-
parseZip64ExtendedInfo
public static boolean parseZip64ExtendedInfo(ZipEntry ze, boolean fromCentralDirectory) throws ZipException
Parse the zip64 extended info record from the extras present inze. IffromCentralDirectoryis true, we assume we're parsing a central directory record. We assume a local file header otherwise. The difference between the two is that a central directory entry is required to be complete, whereas a local file header isn't. This is due to the presence of an optional data descriptor after the file content.- Returns:
- true iff. a zip64 extended info record was found.
- Throws:
ZipException
-
insertZip64ExtendedInfoToExtras
public static void insertZip64ExtendedInfoToExtras(ZipEntry ze) throws ZipException
Appends a zip64 extended info record to the extras contained inze. Ifzecontains no extras, a new extras array is created.- Throws:
ZipException
-
refreshZip64ExtendedInfo
public static void refreshZip64ExtendedInfo(ZipEntry ze)
Copy the size, compressed size and local header offset fields fromzeto insideze's extended info record. This is additional step is necessary when we could calculate the correct sizes only after writing out the entry. In this case, the local file header would not contain real sizes, and they would be present in the data descriptor and the central directory only. We choose the simplest strategy of always writing out the size, compressedSize and local header offset in all our Zip64 Extended info records.
-
writeZip64EocdRecordAndLocator
public static void writeZip64EocdRecordAndLocator(ByteArrayOutputStream baos, long numEntries, long offset, long cDirSize) throws IOException
- Throws:
IOException
-
-