| 83 | } |
| 84 | |
| 85 | size_t read(size_t pos, u8 *dst, size_t len) { |
| 86 | fl::unique_lock<fl::mutex> lock(mMutex); |
| 87 | if (pos >= mData.size()) { |
| 88 | return 0; |
| 89 | } |
| 90 | size_t bytesAvailable = mData.size() - pos; |
| 91 | size_t bytesToActuallyRead = fl::min(len, bytesAvailable); |
| 92 | fl::memcpy(dst, mData.data() + pos, bytesToActuallyRead); |
| 93 | return bytesToActuallyRead; |
| 94 | } |
| 95 | |
| 96 | bool ready(size_t pos) { |
| 97 | fl::unique_lock<fl::mutex> lock(mMutex); |