Grok  7.6.3
IBufferedStream.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2016-2021 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  * You should have received a copy of the GNU Affero General Public License
14  * along with this program. If not, see <http://www.gnu.org/licenses/>.
15  */
16 
17 #pragma once
18 
19 namespace grk {
20 
22 
23  virtual ~IBufferedStream() {
24  }
25 
26  // low level write methods
27  virtual bool write_byte(uint8_t value)=0;
28  virtual bool write_short(uint16_t value) = 0;
29  virtual bool write_24(uint32_t value)=0;
30  virtual bool write_int(uint32_t value) = 0;
31 
39  virtual size_t write_bytes(const uint8_t *p_buffer, size_t p_size)= 0;
40 
45  virtual bool flush()= 0;
46 
53  virtual bool skip(int64_t p_size)= 0;
54 
59  virtual uint64_t tell(void)= 0;
60 
65  virtual uint64_t get_number_byte_left(void)= 0;
66 
73  virtual bool seek(uint64_t offset)= 0;
74 
81  virtual bool has_seek()= 0;
82 
83 };
84 
85 }
grk::IBufferedStream::write_int
virtual bool write_int(uint32_t value)=0
grk::IBufferedStream::has_seek
virtual bool has_seek()=0
Check if stream is seekable.
grk::IBufferedStream::tell
virtual uint64_t tell(void)=0
Tell byte offset in stream (similar to ftell).
grk::IBufferedStream::~IBufferedStream
virtual ~IBufferedStream()
Definition: IBufferedStream.h:23
grk::IBufferedStream::flush
virtual bool flush()=0
Flush write stream to disk.
grk::IBufferedStream::get_number_byte_left
virtual uint64_t get_number_byte_left(void)=0
Get number of bytes left before end of the stream.
grk::IBufferedStream::skip
virtual bool skip(int64_t p_size)=0
Skip bytes in stream, forward or reverse.
grk::IBufferedStream::write_bytes
virtual size_t write_bytes(const uint8_t *p_buffer, size_t p_size)=0
Write bytes to the stream.
grk::IBufferedStream::seek
virtual bool seek(uint64_t offset)=0
Seek to absolute offset in stream.
grk
Copyright (C) 2016-2021 Grok Image Compression Inc.
Definition: BitIO.cpp:23
grk::IBufferedStream::write_short
virtual bool write_short(uint16_t value)=0
grk::IBufferedStream::write_byte
virtual bool write_byte(uint8_t value)=0
grk::IBufferedStream
Definition: IBufferedStream.h:21
grk::IBufferedStream::write_24
virtual bool write_24(uint32_t value)=0