SUMMARY:  INNER | FIELD | CONSTR | METHOD | FRIEND DETAIL:  FIELD | CONSTR | METHOD | FRIEND


Platform::Io
Class BufferedStream

NonCopyableType
   |
   +-IStreamHandler
        |
        +-BufferedStream

Implemented in:
Platform.Io.IStreamHandler.h

class BufferedStream:
public IStreamHandler

Provides streaming from an input File into output File.

See Also:
IStreamHandler

Inner Compounds, Typedefs, and Enumscollapse
enum Constants
          

Field Summarycollapse
const File* in
          Input file stream.
mutable Byte* inBuffer
          Input buffer.
mutable Int inPosition
          Input buffer position cursor.
File* out
          Output file stream.
mutable Byte* outBuffer
          Output buffer.
mutable Int outPosition
          Output buffer position cursor.

Constructor Summarycollapse
BufferedStream(const File* inFile, File* outFile, Byte* inStorage, Byte* outStorage, Int inBufferSize, Int outBufferSize)
          Creates a BufferedStream with the specified input and output files or memory locations.
BufferedStream(const File* inFile, File* outFile, Int inBufferSize = DefaultBufferSize, Int outBufferSize = DefaultBufferSize)
          Creates a BufferedStream with the specified input and output files.
~BufferedStream()
          Destructor.

Method Summarycollapse
Bool avail() const
          Tests whether a byte can be retrieved from the input stream.
Void flush()
          Flushes the output stream.
Byte get() const
          Retrieves a byte from the input stream.
Void put(Byte value)
          Stores a byte in the output stream.

Methods inherited from class IStreamHandlercollapse
avail, flush, get, put

 

Field Detail

in

const File* in

Input file stream.


inBuffer

mutable Byte* inBuffer

Input buffer.


inPosition

mutable Int inPosition

Input buffer position cursor.


out

File* out

Output file stream.


outBuffer

mutable Byte* outBuffer

Output buffer.


outPosition

mutable Int outPosition

Output buffer position cursor.

 

Constructor Detail

BufferedStream[inline]

BufferedStream(const File* inFile, File* outFile, Byte* inStorage, Byte* outStorage, Int inBufferSize, Int outBufferSize)

Creates a BufferedStream with the specified input and output files or memory locations. This method allows for streaming of data to and from files and memory.

If the inFile parameter is Null then the inStorage is used as a data source holding inBufferSize bytes. If inFile is not Null then the inStorage and inBufferSize are used to specify a user allocated buffer for the input stream. In this case, if inStorage is Null then the buffer is allocated automatically and released when a BufferedStream object goes out of scope.

If the outFile parameter is Null then the outStorage is used as data destination of size outBufferSize bytes. If outFile is not Null then the outStorage and outBufferSize are used to specify a user allocated buffer for the output stream. In this case, if outStorage is Null then the buffer is allocated automatically and released when a BufferedStream object goes out of scope.

If both inFile and outFile are set to Null then the data is streamed in memory.

Parameters:
inFile - input file stream (optional)
outFile - output file stream (optional)
inStorage - input buffer storage
outStorage - output buffer storage
inBufferSize - input buffer size, must not be 0
outBufferSize - output buffer size, must not be 0

BufferedStream[inline]

BufferedStream(const File* inFile, File* outFile, Int inBufferSize = DefaultBufferSize, Int outBufferSize = DefaultBufferSize)

Creates a BufferedStream with the specified input and output files.

Parameters:
inFile - input file stream
outFile - output file stream
inBufferSize - input buffer size
outBufferSize - output buffer size

~BufferedStream[inline]

~BufferedStream()

Destructor.

 

Method Detail

avail[virtual, inline]

Bool avail() const

Tests whether a byte can be retrieved from the input stream.

Returns:
True if a byte can be retrieved by the subsequent get() method, False otherwise
Implements:
IStreamHandler::avail

flush[virtual, inline]

Void flush()

Flushes the output stream.

Overrides:
IStreamHandler::flush

get[virtual, inline]

Byte get() const

Retrieves a byte from the input stream.

Returns:
a byte from the input stream
Implements:
IStreamHandler::get

put[virtual, inline]

Void put(Byte value)

Stores a byte in the output stream.

Parameters:
value - the value to store in the output stream
Implements:
IStreamHandler::put


SUMMARY:  INNER | FIELD | CONSTR | METHOD | FRIEND DETAIL:  FIELD | CONSTR | METHOD | FRIEND