Source:
public ParquetMetadata readParquetMetadata(final InputStream from, MetadataFilter filter, final InternalFileDecryptor fileDecryptor, final boolean encryptedFooter, final int combinedFooterLength) throws IOException { final BlockCipher.Decryptor footerDecryptor = (encryptedFooter? fileDecryptor.fetchFooterDecryptor() : null); final byte[] encryptedFooterAAD = (encryptedFooter? AesCipher.createFooterAAD(fileDecryptor.getFileAAD()) : null); FileMetaData fileMetaData = filter.accept(new MetadataFilterVisitor<FileMetaData, IOException>() { @Override public FileMetaData visit(NoFilter filter) throws IOException { return readFileMetaData(from, footerDecryptor, encryptedFooterAAD); } @Override public FileMetaData visit(SkipMetadataFilter filter) throws IOException { return readFileMetaData(from, true, footerDecryptor, encryptedFooterAAD); } @Override public FileMetaData visit(OffsetMetadataFilter filter) throws IOException { return filterFileMetaDataByStart(readFileMetaData(from, footerDecryptor, encryptedFooterAAD), filter); } @Override public FileMetaData visit(RangeMetadataFilter filter) throws IOException { return filterFileMetaDataByMidpoint(readFileMetaData(from, footerDecryptor, encryptedFooterAAD), filter); } }); LOG.debug("{}", fileMetaData); if (!encryptedFooter && null != fileDecryptor) { if (!fileMetaData.isSetEncryption_algorithm()) { fileDecryptor.setPlaintextFile(); if (!fileDecryptor.plaintextFilesAllowed()) { throw new IOException("Applying decryptor on plaintext file"); } } else { fileDecryptor.setFileCryptoMetaData(fileMetaData.getEncryption_algorithm(), false, fileMetaData.getFooter_signing_key_metadata()); if (fileDecryptor.checkFooterIntegrity()) { verifyFooterIntegrity(from, fileDecryptor, combinedFooterLength); } } } ParquetMetadata parquetMetadata = fromParquetMetadata(fileMetaData, fileDecryptor, encryptedFooter); if (LOG.isDebugEnabled()) LOG.debug(ParquetMetadata.toPrettyJSON(parquetMetadata)); return parquetMetadata; }

Target:
public ParquetMetadata readParquetMetadata(final InputStream from, MetadataFilter filter, final InternalFileDecryptor fileDecryptor, final boolean encryptedFooter, final int combinedFooterLength) throws IOException { final BlockCipher.Decryptor footerDecryptor = (encryptedFooter? fileDecryptor.fetchFooterDecryptor() : null); final byte[] encryptedFooterAAD = (encryptedFooter? AesCipher.createFooterAAD(fileDecryptor.getFileAAD()) : null); FileMetaData fileMetaData = filter.accept(new MetadataFilterVisitor<FileMetaData, IOException>() { @Override public FileMetaData visit(NoFilter filter) throws IOException { return readFileMetaData(from, footerDecryptor, encryptedFooterAAD); } @Override public FileMetaData visit(SkipMetadataFilter filter) throws IOException { return readFileMetaData(from, true, footerDecryptor, encryptedFooterAAD); } @Override public FileMetaData visit(OffsetMetadataFilter filter) throws IOException { return filterFileMetaDataByStart(readFileMetaData(from, footerDecryptor, encryptedFooterAAD), filter); } @Override public FileMetaData visit(RangeMetadataFilter filter) throws IOException { return filterFileMetaDataByMidpoint(readFileMetaData(from, footerDecryptor, encryptedFooterAAD), filter); } }); LOG.debug("{}", fileMetaData); if (!encryptedFooter && null != fileDecryptor) { if (!fileMetaData.isSetEncryption_algorithm()) { fileDecryptor.setPlaintextFile(); if (!fileDecryptor.plaintextFilesAllowed()) { throw new ParquetCryptoRuntimeException("Applying decryptor on plaintext file"); } } else { fileDecryptor.setFileCryptoMetaData(fileMetaData.getEncryption_algorithm(), false, fileMetaData.getFooter_signing_key_metadata()); if (fileDecryptor.checkFooterIntegrity()) { verifyFooterIntegrity(from, fileDecryptor, combinedFooterLength); } } } ParquetMetadata parquetMetadata = fromParquetMetadata(fileMetaData, fileDecryptor, encryptedFooter); if (LOG.isDebugEnabled()) LOG.debug(ParquetMetadata.toPrettyJSON(parquetMetadata)); return parquetMetadata; }