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

Method write

libminifi/src/io/FileStream.cpp:86–108  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

84}
85
86int FileStream::write(const uint8_t *value, int size) {
87 gsl_Expects(size >= 0);
88 if (size == 0) {
89 return 0;
90 }
91 if (!IsNullOrEmpty(value)) {
92 std::lock_guard<std::mutex> lock(file_lock_);
93 if (file_stream_->write(reinterpret_cast<const char*>(value), size)) {
94 offset_ += size;
95 if (offset_ > length_) {
96 length_ = offset_;
97 }
98 if (!file_stream_->flush()) {
99 return -1;
100 }
101 return size;
102 } else {
103 return -1;
104 }
105 } else {
106 return -1;
107 }
108}
109
110int FileStream::read(uint8_t *buf, int buflen) {
111 gsl_Expects(buflen >= 0);

Callers

nothing calls this directly

Calls 2

IsNullOrEmptyFunction · 0.85
flushMethod · 0.45

Tested by

no test coverage detected