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

Method SkipNBytes

tensorflow/core/lib/io/inputbuffer.cc:150–174  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

148}
149
150Status InputBuffer::SkipNBytes(int64 bytes_to_skip) {
151 if (bytes_to_skip < 0) {
152 return errors::InvalidArgument("Can only skip forward, not ",
153 bytes_to_skip);
154 }
155 int64 bytes_skipped = 0;
156 Status s;
157 while (bytes_skipped < bytes_to_skip) {
158 if (pos_ == limit_) {
159 // Get more data into buffer
160 s = FillBuffer();
161 if (limit_ == buf_) {
162 break;
163 }
164 }
165 const int64 bytes_to_advance =
166 std::min<int64>(limit_ - pos_, bytes_to_skip - bytes_skipped);
167 bytes_skipped += bytes_to_advance;
168 pos_ += bytes_to_advance;
169 }
170 if (errors::IsOutOfRange(s) && bytes_skipped == bytes_to_skip) {
171 return Status::OK();
172 }
173 return s;
174}
175
176Status InputBuffer::Seek(int64 position) {
177 if (position < 0) {

Callers 15

ReadStringMethod · 0.45
TESTFunction · 0.45
TestSkipNBytesFunction · 0.45
TESTFunction · 0.45
GetMetadataMethod · 0.45
ReadRecordMethod · 0.45
TESTFunction · 0.45
TESTFunction · 0.45
OnWorkStartedLockedMethod · 0.45
ReadLockedMethod · 0.45
GetNextInternalMethod · 0.45
GetNextInternalMethod · 0.45

Calls 1

InvalidArgumentFunction · 0.85

Tested by 5

TESTFunction · 0.36
TestSkipNBytesFunction · 0.36
TESTFunction · 0.36
TESTFunction · 0.36
TESTFunction · 0.36