| 630 | } |
| 631 | |
| 632 | void WriteEncryptedFileMetadata(const FileMetaData& file_metadata, |
| 633 | ArrowOutputStream* sink, |
| 634 | const std::shared_ptr<Encryptor>& encryptor, |
| 635 | bool encrypt_footer) { |
| 636 | if (encrypt_footer) { // Encrypted file with encrypted footer |
| 637 | // encrypt and write to sink |
| 638 | file_metadata.WriteTo(sink, encryptor); |
| 639 | } else { // Encrypted file with plaintext footer mode. |
| 640 | PARQUET_ASSIGN_OR_THROW(int64_t position, sink->Tell()); |
| 641 | uint32_t metadata_len = static_cast<uint32_t>(position); |
| 642 | file_metadata.WriteTo(sink, encryptor); |
| 643 | PARQUET_ASSIGN_OR_THROW(position, sink->Tell()); |
| 644 | metadata_len = static_cast<uint32_t>(position) - metadata_len; |
| 645 | |
| 646 | { |
| 647 | uint32_t metadata_len_le = ::arrow::bit_util::ToLittleEndian(metadata_len); |
| 648 | PARQUET_THROW_NOT_OK(sink->Write(reinterpret_cast<uint8_t*>(&metadata_len_le), 4)); |
| 649 | } |
| 650 | PARQUET_THROW_NOT_OK(sink->Write(kParquetMagic, 4)); |
| 651 | } |
| 652 | } |
| 653 | |
| 654 | void WriteFileCryptoMetaData(const FileCryptoMetaData& crypto_metadata, |
| 655 | ArrowOutputStream* sink) { |
no test coverage detected