Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/ClusterM/flipperzero-firmware.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'lib/toolbox/stream/stream_cache.h')
-rw-r--r--lib/toolbox/stream/stream_cache.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/lib/toolbox/stream/stream_cache.h b/lib/toolbox/stream/stream_cache.h
index 20c18d80..f61e5e8f 100644
--- a/lib/toolbox/stream/stream_cache.h
+++ b/lib/toolbox/stream/stream_cache.h
@@ -56,6 +56,14 @@ size_t stream_cache_pos(StreamCache* cache);
size_t stream_cache_fill(StreamCache* cache, Stream* stream);
/**
+ * Write as much cached data as possible to a stream.
+ * @param cache Pointer to a StreamCache instance
+ * @param stream Pointer to a Stream instance
+ * @return True on success, False on failure.
+ */
+bool stream_cache_flush(StreamCache* cache, Stream* stream);
+
+/**
* Read cached data and advance the internal cursor.
* @param cache Pointer to a StreamCache instance.
* @param data Pointer to a data buffer. Must be initialized.
@@ -65,6 +73,15 @@ size_t stream_cache_fill(StreamCache* cache, Stream* stream);
size_t stream_cache_read(StreamCache* cache, uint8_t* data, size_t size);
/**
+ * Write to cached data and advance the internal cursor.
+ * @param cache Pointer to a StreamCache instance.
+ * @param data Pointer to a data buffer.
+ * @param size Maximum size in bytes to write to the cache.
+ * @return Actual size that was written.
+ */
+size_t stream_cache_write(StreamCache* cache, const uint8_t* data, size_t size);
+
+/**
* Move the internal cursor relatively to its current position.
* @param cache Pointer to a StreamCache instance.
* @param offset Cursor offset.