1 /* ScummVM - Graphic Adventure Engine
2  *
3  * ScummVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the COPYRIGHT
5  * file distributed with this source distribution.
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation; either version 2
10  * of the License, or (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20  *
21  */
22 
23 #ifndef COMMON_BUFFEREDSTREAM_H
24 #define COMMON_BUFFEREDSTREAM_H
25 
26 #include "common/stream.h"
27 #include "common/types.h"
28 
29 namespace Common {
30 
31 /**
32  * Take an arbitrary ReadStream and wrap it in a custom stream which
33  * transparently provides buffering.
34  * Users can specify how big the buffer should be, and whether the wrapped
35  * stream should be disposed when the wrapper is disposed.
36  *
37  * It is safe to call this with a NULL parameter (in this case, NULL is
38  * returned).
39  */
40 ReadStream *wrapBufferedReadStream(ReadStream *parentStream, uint32 bufSize, DisposeAfterUse::Flag disposeParentStream);
41 
42 /**
43  * Take an arbitrary SeekableReadStream and wrap it in a custom stream which
44  * transparently provides buffering.
45  * Users can specify how big the buffer should be, and whether the wrapped
46  * stream should be disposed when the wrapper is disposed.
47  *
48  * It is safe to call this with a NULL parameter (in this case, NULL is
49  * returned).
50  */
51 SeekableReadStream *wrapBufferedSeekableReadStream(SeekableReadStream *parentStream, uint32 bufSize, DisposeAfterUse::Flag disposeParentStream);
52 
53 /**
54  * Take an arbitrary WriteStream and wrap it in a custom stream which
55  * transparently provides buffering.
56  * Users can specify how big the buffer should be. Currently, the
57  * parent stream is \em always disposed when the wrapper is disposed.
58  *
59  * It is safe to call this with a NULL parameter (in this case, NULL is
60  * returned).
61  */
62 WriteStream *wrapBufferedWriteStream(WriteStream *parentStream, uint32 bufSize);
63 
64 } // End of namespace Common
65 
66 #endif
67