| 648 | } |
| 649 | |
| 650 | void WriteEncryptedFileMetadata(const FileMetaData& file_metadata, |
| 651 | ArrowOutputStream* sink, |
| 652 | const std::shared_ptr<Encryptor>& encryptor, |
| 653 | bool encrypt_footer) { |
| 654 | if (encrypt_footer) { // Encrypted file with encrypted footer |
| 655 | // encrypt and write to sink |
| 656 | file_metadata.WriteTo(sink, encryptor); |
| 657 | } else { // Encrypted file with plaintext footer mode. |
| 658 | PARQUET_ASSIGN_OR_THROW(int64_t position, sink->Tell()); |
| 659 | uint32_t metadata_len = static_cast<uint32_t>(position); |
| 660 | file_metadata.WriteTo(sink, encryptor); |
| 661 | PARQUET_ASSIGN_OR_THROW(position, sink->Tell()); |
| 662 | metadata_len = static_cast<uint32_t>(position) - metadata_len; |
| 663 | |
| 664 | { |
| 665 | uint32_t metadata_len_le = ::arrow::bit_util::ToLittleEndian(metadata_len); |
| 666 | PARQUET_THROW_NOT_OK(sink->Write(reinterpret_cast<uint8_t*>(&metadata_len_le), 4)); |
| 667 | } |
| 668 | PARQUET_THROW_NOT_OK(sink->Write(kParquetMagic, 4)); |
| 669 | } |
| 670 | } |
| 671 | |
| 672 | void WriteFileCryptoMetaData(const FileCryptoMetaData& crypto_metadata, |
| 673 | ArrowOutputStream* sink) { |
no test coverage detected