final boolean isDataDescriptorRequired() { return UNKNOWN == (getCrc() | getCompressedSize() | getSize()); }
if (UNKNOWN != (value = getTime())) f.format(", time=%tc", value); if (UNKNOWN != (value = getCrc())) f.format(", crc=0x%08X", value); if (UNKNOWN != (value = getCompressedSize()))
@Override public void close() throws IOException { if (!closed) { while (skip(Long.MAX_VALUE) > 0) { // process CRC-32 until EOF } } super.close(); closed = true; final long expected = entry.getCrc(); final long computed = getChecksum().getValue(); if (expected != computed) throw new CRC32Exception(entry.getName(), expected, computed); } }
@Test public void testCrc() { try { entry.setCrc(UNKNOWN - 1); fail(); } catch (IllegalArgumentException expected) { } try { entry.setCrc(UInt.MAX_VALUE + 1); fail(); } catch (IllegalArgumentException expected) { } assertEquals(UNKNOWN, entry.getCrc()); entry.setCrc(UInt.MIN_VALUE); assertEquals(UInt.MIN_VALUE, entry.getCrc()); entry.setCrc(UInt.MAX_VALUE); assertEquals(UInt.MAX_VALUE, entry.getCrc()); entry.setCrc(UNKNOWN); assertEquals(UNKNOWN, entry.getCrc()); }
assert UNKNOWN != entry.getCrc(); return processor;