Stroika Library 3.0d16
 
Loading...
Searching...
No Matches
BufferedInputStream.h File Reference
#include "Stroika/Foundation/StroikaPreComp.h"
#include "Stroika/Foundation/Execution/Synchronized.h"
#include "Stroika/Foundation/Streams/InputStream.h"
#include "BufferedInputStream.inl"

Go to the source code of this file.

Classes

class  Stroika::Foundation::Streams::BufferedInputStream::Ptr< ELEMENT_TYPE >
 

Namespaces

namespace  Stroika::Foundation
 

Functions

template<typename ELEMENT_TYPE >
Ptr< ELEMENT_TYPE > Stroika::Foundation::Streams::BufferedInputStream::New (const typename InputStream::Ptr< ELEMENT_TYPE > &realIn, optional< bool > seekable={})
 BufferedInputStream is an InputStream::Ptr<ELEMENT_TYPE> which provides buffered access. This is useful if calls to the underling stream source can be expensive. This class loads chunks of the stream into memory, and reduces calls to the underlying stream.
 

Detailed Description

Note
Code-Status: Beta

TODO:

Definition in file BufferedInputStream.h.

Function Documentation

◆ New()

template<typename ELEMENT_TYPE >
Ptr< ELEMENT_TYPE > Stroika::Foundation::Streams::BufferedInputStream::New ( const typename InputStream::Ptr< ELEMENT_TYPE > &  realIn,
optional< bool >  seekable = {} 
)

BufferedInputStream is an InputStream::Ptr<ELEMENT_TYPE> which provides buffered access. This is useful if calls to the underling stream source can be expensive. This class loads chunks of the stream into memory, and reduces calls to the underlying stream.

Note
if seekable true, the resulting stream is seekable. If seekable is false, the resulting stream is not seekable. If seekable is unspecified (nullopt), the resulting stream is seekable iff the source stream is seekable.

Specifying true (seekable) when the source stream is not seekable is allowed, but requires enuf memory to buffer the ENTIRE contents of the stream (other cases just buffer a bit so require more modest amounts of memory).

Note
See Also StreamReader, as for consumers, this will often work the same as BufferedInputStream, but be somewhat more performant.
Example Usage
InputStream::Ptr<byte> in = BufferedInputStream::New<byte> (fromStream);
Example Usage
CallExpectingBinaryInputStreamPtr (BufferedInputStream::New<byte> (fromStream))
Note
Thread-Safety C++-Standard-Thread-Safety-For-Envelope-Plus-Must-Externally-Synchronize-Letter

Definition at line 254 of file BufferedInputStream.inl.