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

Go to the source code of this file.

Classes

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

Namespaces

namespace  Stroika::Foundation
 

Functions

template<typename ELEMENT_TYPE >
Ptr< ELEMENT_TYPE > Stroika::Foundation::Streams::BufferedOutputStream::New (const typename OutputStream::Ptr< ELEMENT_TYPE > &realOut, const optional< size_t > &bufferSize=nullopt)
 

Detailed Description

Note
Code-Status: Beta

TODO:

    BufferedOutputStream NOW must properly support SEEKABLE! if arg
    is seekable, we must override seek methods, and forward them, and adjust buffer as appropriate.

Definition in file BufferedOutputStream.h.

Function Documentation

◆ New()

template<typename ELEMENT_TYPE >
Ptr< ELEMENT_TYPE > Stroika::Foundation::Streams::BufferedOutputStream::New ( const typename OutputStream::Ptr< ELEMENT_TYPE > &  realOut,
const optional< size_t > &  bufferSize = nullopt 
)

A BufferedOutputStream wraps an argument stream (which must have lifetime > this BufferedOutputStream) and will buffer up writes to it.

\note   If you fail to Flush() this object before it is destroyed, exceptions in flushing
        the data may be suppressed.
        Best to call @Close ()

\note   BufferedOutputStream aggregates its owned sub-stream, so that a Close () on BufferedOutputStream
        will Close that sub-stream.

\note   \em Thread-Safety   <a href="Thread-Safety.md#C++-Standard-Thread-Safety-For-Envelope-Plus-Must-Externally-Synchronize-Letter">C++-Standard-Thread-Safety-For-Envelope-Plus-Must-Externally-Synchronize-Letter</a>
Example Usage
OutputStream::Ptr<byte> out = BufferedOutputStream::New<byte> (FileOutputStream (fileName, flushFlag));

Definition at line 168 of file BufferedOutputStream.inl.