phrocker commented on a change in pull request #540: MINIFICPP-809: Better 
support python capabilities and recordreader/wr…
URL: https://github.com/apache/nifi-minifi-cpp/pull/540#discussion_r277759614
 
 

 ##########
 File path: libminifi/src/io/FileStream.cpp
 ##########
 @@ -28,12 +28,15 @@ namespace nifi {
 namespace minifi {
 namespace io {
 
-FileStream::FileStream(const std::string &path)
+FileStream::FileStream(const std::string &path, bool append)
     : logger_(logging::LoggerFactory<FileStream>::getLogger()),
       path_(path),
       offset_(0) {
   file_stream_ = std::unique_ptr<std::fstream>(new std::fstream());
-  file_stream_->open(path.c_str(), std::fstream::out | std::fstream::binary);
+  if (append)
+    file_stream_->open(path.c_str(), std::fstream::in | std::fstream::out | 
std::fstream::app | std::fstream::binary);
 
 Review comment:
   That bit sets the flag to allow output operations to append at the end but 
there is nothing to suggest we won't be reading. Further, we need to be able to 
read and seek to get length ( since we're using the input tellg -- could change 
this to tellp, but based on when and where that call is made we likely want to 
have an input sequence as well ). Finally we don't want to assume user intent 
on this stream. 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to