Grok  9.7.5
IBufferedStream.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2016-2022 Grok Image Compression Inc.
3  *
4  * This source code is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU Affero General Public License, version 3,
6  * as published by the Free Software Foundation.
7  *
8  * This source code is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * GNU Affero General Public License for more details.
12  *
13  */
14 
15 #pragma once
16 
17 namespace grk
18 {
20 {
21  virtual ~IBufferedStream() = default;
22 
23  virtual bool supportsZeroCopy() = 0;
24  virtual uint8_t* getZeroCopyPtr() = 0;
35  virtual size_t read(uint8_t* buffer, size_t p_size) = 0;
36 
37  // low level write methods
38  virtual bool writeShort(uint16_t value) = 0;
39  virtual bool write24(uint32_t value) = 0;
40  virtual bool writeInt(uint32_t value) = 0;
41  virtual bool write64(uint64_t value) = 0;
42 
43  virtual bool writeByte(uint8_t value) = 0;
51  virtual size_t writeBytes(const uint8_t* buffer, size_t p_size) = 0;
52 
57  virtual bool flush() = 0;
58 
65  virtual bool skip(int64_t p_size) = 0;
66 
71  virtual uint64_t tell(void) = 0;
72 
77  virtual uint64_t numBytesLeft(void) = 0;
78 
85  virtual bool seek(uint64_t offset) = 0;
86 
93  virtual bool hasSeek() = 0;
94 };
95 
96 } // namespace grk
Copyright (C) 2016-2022 Grok Image Compression Inc.
Definition: ICacheable.h:20
Definition: IBufferedStream.h:20
virtual bool write64(uint64_t value)=0
virtual uint8_t * getZeroCopyPtr()=0
virtual bool writeInt(uint32_t value)=0
virtual bool supportsZeroCopy()=0
virtual size_t read(uint8_t *buffer, size_t p_size)=0
Reads some bytes from the stream.
virtual bool skip(int64_t p_size)=0
Skip bytes in stream, forward or reverse.
virtual uint64_t numBytesLeft(void)=0
Get number of bytes left before end of the stream.
virtual bool hasSeek()=0
Check if stream is seekable.
virtual bool seek(uint64_t offset)=0
Seek to absolute offset in stream.
virtual uint64_t tell(void)=0
Tell byte offset in stream (similar to ftell).
virtual size_t writeBytes(const uint8_t *buffer, size_t p_size)=0
Write bytes to the stream.
virtual bool flush()=0
Flush write stream to disk.
virtual bool writeByte(uint8_t value)=0
virtual bool write24(uint32_t value)=0
virtual bool writeShort(uint16_t value)=0
virtual ~IBufferedStream()=default