| 519 | } |
| 520 | |
| 521 | DataBuf FileIo::read(size_t rcount) { |
| 522 | if (rcount > size()) |
| 523 | throw Error(ErrorCode::kerInvalidMalloc); |
| 524 | DataBuf buf(rcount); |
| 525 | size_t readCount = read(buf.data(), buf.size()); |
| 526 | if (readCount == 0) { |
| 527 | throw Error(ErrorCode::kerInputDataReadFailed); |
| 528 | } |
| 529 | buf.resize(readCount); |
| 530 | return buf; |
| 531 | } |
| 532 | |
| 533 | size_t FileIo::read(byte* buf, size_t rcount) { |
| 534 | if (p_->switchMode(Impl::opRead) != 0) { |
no test coverage detected