final boolean isZip64ExtensionsRequired() { // Offset MUST be considered in decision about ZIP64 format - see // description of Data Descriptor in ZIP File Format Specification! if (FORCE_ZIP64_EXT) return true /*UNKNOWN != getCompressedSize() || UNKNOWN != getSize() || UNKNOWN != getOffset()*/; else return UInt.MAX_VALUE <= getCompressedSize() || UInt.MAX_VALUE <= getSize() || UInt.MAX_VALUE <= getOffset(); }
final boolean isDataDescriptorRequired() { return UNKNOWN == (getCrc() | getCompressedSize() | getSize()); }
if (UNKNOWN != (value = getCrc())) f.format(", crc=0x%08X", value); if (UNKNOWN != (value = getCompressedSize())) f.format(", compressedSize=%d", value); if (UNKNOWN != (value = getSize()))
final long csize = getCompressedSize(); if (FORCE_ZIP64_EXT && UNKNOWN != csize || UInt.MAX_VALUE <= csize) { writeLong(csize, data, off);
@Test public void testCompressedSize() { try { entry.setCompressedSize(UNKNOWN - 1); fail(); } catch (IllegalArgumentException expected) { } try { entry.setCompressedSize(ULong.MAX_VALUE + 1); fail(); } catch (IllegalArgumentException expected) { } assertEquals(UNKNOWN, entry.getCompressedSize()); entry.setCompressedSize(UInt.MIN_VALUE); assertEquals(UInt.MIN_VALUE, entry.getCompressedSize()); entry.setCompressedSize(UInt.MAX_VALUE); assertEquals(UInt.MAX_VALUE, entry.getCompressedSize()); entry.setCompressedSize(UInt.MAX_VALUE + 1); // ZIP64! assertEquals(UInt.MAX_VALUE + 1, entry.getCompressedSize()); entry.setCompressedSize(UNKNOWN); assertEquals(UNKNOWN, entry.getCompressedSize()); }
try { erof = new EntryReadOnlyFile( fp, entry.getCompressedSize()); } catch (IllegalArgumentException ex) { throw (IOException) new ZipException(name + rof.seek(fp + entry.getCompressedSize()); rof.readFully(dd); localCrc = readUInt(dd, 0);
assertEquals(0x0fedcba987654322L, entry.getCompressedSize()); assertEquals(UInt.MAX_VALUE, entry.getRawCompressedSize()); assertEquals(0x0fedcba987654323L, entry.getOffset());
throw new CRC32Exception(entry.getName(), entry.getCrc(), crc); if (entry.getCompressedSize() != csize) throw new ZipException(entry.getName() + " (invalid compressed size in Data Descriptor)"); fp += entry.getCompressedSize(); rof.seek(fp - 1); if (fp > length || -1 == rof.read())
final long csize = entry.getCompressedSize(); final long size = entry.getSize();