MCPcopy Create free account
hub / github.com/apache/nifi-minifi-cpp / write

Method write

libminifi/src/utils/file/FileSystem.cpp:60–74  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

58}
59
60bool FileSystem::write(const std::string& file_name, const std::string& file_content) {
61 std::ofstream output{file_name, std::ios::binary};
62 if (should_encrypt_on_write_) {
63 // allow a possible exception to propagate upward
64 // if we fail to encrypt the file DON'T just write
65 // it as-is
66 logger_->log_debug("Encrypting file %s", file_name);
67 output << encryptor_->encrypt(file_content);
68 } else {
69 logger_->log_debug("No encryption is required for file %s", file_name);
70 output << file_content;
71 }
72 output.close();
73 return static_cast<bool>(output);
74}
75
76} // namespace file
77} // namespace utils

Callers

nothing calls this directly

Calls 3

log_debugMethod · 0.80
encryptMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected