| 839 | } |
| 840 | |
| 841 | Status CheckPosition(int64_t position, const char* action) const { |
| 842 | DCHECK_GE(content_length_, 0); |
| 843 | if (position < 0) { |
| 844 | return Status::Invalid("Cannot ", action, " from negative position"); |
| 845 | } |
| 846 | if (position > content_length_) { |
| 847 | return Status::IOError("Cannot ", action, " past end of file"); |
| 848 | } |
| 849 | return Status::OK(); |
| 850 | } |
| 851 | |
| 852 | // RandomAccessFile APIs |
| 853 |