From 40037ecb34b4e5ae3ac64cc3628206dddd0275b2 Mon Sep 17 00:00:00 2001 From: yvt Date: Sun, 19 May 2019 13:12:16 +0900 Subject: [PATCH] Add `RandomAccessAdaptor::Prefetch` --- Sources/Core/RandomAccessAdaptor.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Sources/Core/RandomAccessAdaptor.h b/Sources/Core/RandomAccessAdaptor.h index 9c18537f..988073ec 100644 --- a/Sources/Core/RandomAccessAdaptor.h +++ b/Sources/Core/RandomAccessAdaptor.h @@ -84,6 +84,15 @@ namespace spades { } } + /** + * Read the inner stream ahead to make the internal buffer at least `length` bytes long. + */ + void Prefetch(std::size_t length) { + SPADES_MARK_FUNCTION(); + + ExpandTo(length); + } + private: /** * Tries to ensure `buffer` is at least `newBufferSize` bytes long.