private void validate() throws IOException { long compressedSize = inCounted.getSize(); // Validate Compressed Size and Uncompressed Size if they were // present in Block Header. if ((compressedSizeInHeader != -1 && compressedSizeInHeader != compressedSize) || (uncompressedSizeInHeader != -1 && uncompressedSizeInHeader != uncompressedSize)) throw new CorruptedInputException(); // Block Padding bytes must be zeros. while ((compressedSize++ & 3) != 0) if (inData.readUnsignedByte() != 0x00) throw new CorruptedInputException(); // Validate the integrity check. byte[] storedCheck = new byte[check.getSize()]; inData.readFully(storedCheck); if (!Arrays.equals(check.finish(), storedCheck)) throw new CorruptedInputException("Integrity check (" + check.getName() + ") does not match"); }