MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / Read

Method Read

tensorflow/core/lib/io/recordio_test.cc:85–101  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

83 : contents_(contents), force_error_(false) {}
84
85 Status Read(uint64 offset, size_t n, StringPiece* result,
86 char* scratch) const override {
87 if (force_error_) {
88 force_error_ = false;
89 return errors::DataLoss("read error");
90 }
91
92 if (offset >= contents_->size()) {
93 return errors::OutOfRange("end of file");
94 }
95
96 if (contents_->size() < offset + n) {
97 n = contents_->size() - offset;
98 }
99 *result = StringPiece(contents_->data() + offset, n);
100 return Status::OK();
101 }
102
103 void force_error() { force_error_ = true; }
104

Callers

nothing calls this directly

Calls 2

sizeMethod · 0.45
dataMethod · 0.45

Tested by

no test coverage detected