8LinkOutputStream::LinkOutputStream(LinkOutputStream&& other) {
9 channel_ = other.channel_;
10 my_stream_id_ = other.my_stream_id_;
11 status_ = other.status_;
12 other.channel_ =
nullptr;
13 other.my_stream_id_ = 0;
14 other.status_ = roo_io::kClosed;
17LinkOutputStream& LinkOutputStream::operator=(LinkOutputStream&& other) {
19 channel_ = other.channel_;
20 my_stream_id_ = other.my_stream_id_;
21 status_ = other.status_;
22 other.channel_ =
nullptr;
23 other.my_stream_id_ = 0;
24 other.status_ = roo_io::kClosed;
29size_t LinkOutputStream::write(
const roo::byte* buf,
size_t count) {
30 if (status_ != roo_io::kOk)
return 0;
31 if (count == 0)
return 0;
32 return channel_->write(buf, count, my_stream_id_, status_);
50size_t LinkOutputStream::tryWrite(
const roo::byte* buf,
size_t count) {
51 if (status_ != roo_io::kOk)
return 0;
52 return channel_->tryWrite(buf, count, my_stream_id_, status_);
55size_t LinkOutputStream::availableForWrite() {
56 if (status_ != roo_io::kOk)
return 0;
57 return channel_->availableForWrite(my_stream_id_, status_);
60void LinkOutputStream::flush() {
61 if (status_ != roo_io::kOk)
return;
62 channel_->flush(my_stream_id_, status_);
65void LinkOutputStream::close() {
66 if (status_ != roo_io::kOk)
return;
67 channel_->close(my_stream_id_, status_);
68 if (status_ == roo_io::kOk) status_ = roo_io::kClosed;