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

Method FileStream

libminifi/src/io/FileStream.cpp:34–50  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

32namespace io {
33
34FileStream::FileStream(const std::string &path, bool append)
35 : logger_(logging::LoggerFactory<FileStream>::getLogger()),
36 path_(path),
37 offset_(0) {
38 file_stream_ = std::unique_ptr<std::fstream>(new std::fstream());
39 if (append) {
40 file_stream_->open(path.c_str(), std::fstream::in | std::fstream::out | std::fstream::app | std::fstream::binary);
41 file_stream_->seekg(0, file_stream_->end);
42 file_stream_->seekp(0, file_stream_->end);
43 std::streamoff len = file_stream_->tellg();
44 length_ = len > 0 ? gsl::narrow<size_t>(len) : 0;
45 seek(offset_);
46 } else {
47 file_stream_->open(path.c_str(), std::fstream::out | std::fstream::binary);
48 length_ = 0;
49 }
50}
51
52FileStream::FileStream(const std::string &path, uint32_t offset, bool write_enable)
53 : logger_(logging::LoggerFactory<FileStream>::getLogger()),

Callers

nothing calls this directly

Calls 2

openMethod · 0.80
c_strMethod · 0.80

Tested by

no test coverage detected