MCPcopy Create free account
hub / github.com/apache/arrow / Write

Method Write

cpp/src/arrow/io/memory.cc:98–111  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

96Result<int64_t> BufferOutputStream::Tell() const { return position_; }
97
98Status BufferOutputStream::Write(const void* data, int64_t nbytes) {
99 if (ARROW_PREDICT_FALSE(!is_open_)) {
100 return Status::IOError("OutputStream is closed");
101 }
102 DCHECK(buffer_);
103 if (ARROW_PREDICT_TRUE(nbytes > 0)) {
104 if (ARROW_PREDICT_FALSE(position_ + nbytes >= capacity_)) {
105 RETURN_NOT_OK(Reserve(nbytes));
106 }
107 memcpy(mutable_data_ + position_, data, nbytes);
108 position_ += nbytes;
109 }
110 return Status::OK();
111}
112
113Status BufferOutputStream::Reserve(int64_t nbytes) {
114 // Always overallocate by doubling. It seems that it is a better growth

Callers

nothing calls this directly

Calls 3

IOErrorFunction · 0.85
ReserveFunction · 0.50
OKFunction · 0.50

Tested by

no test coverage detected