Class ABufferedOutputStream

DescriptionHierarchyFieldsMethodsProperties

Unit

Declaration

type ABufferedOutputStream = class(ABufferedStream)

Description

This class wraps around an output stream and buffers output to that stream. Before the buffered stream instance is destroyed, any data remaining in the buffer will be flushed to the target stream.

Hierarchy

Overview

Methods

Protected function refreshBuffer: TStreamIOSize; override;
Public destructor destroy; override;
Public function write(const count: TStreamIOSize; const source): TStreamIOSize; override;
Public function setPosition(newPosition: TStreamOffset): TStreamOffset; override;

Description

Methods

Protected function refreshBuffer: TStreamIOSize; override;

Refresh the buffer.

This method flushes the contents of the buffer to the underlying stream, then zeroes the buffer for use in future write operations.

Returns

The total number of bytes written to the underlying stream.

Public destructor destroy; override;

Free the stream and the buffer associated with it.

This method overrides the behavior inherited from ABufferedStream. It flushes any data remaining in its buffer to the target stream before calling the inherited routine.

Public function write(const count: TStreamIOSize; const source): TStreamIOSize; override;

Write count bytes of source to the stream.

It is the caller's responsibility to ensure that source has at least count bytes ready to be written; failure to do so will likely cause your code to crash.

This method writes data to the buffer. If the end of the buffer is reached before count bytes have been written, then the contents of the buffer are flushed to the target stream before writing continues.

Returns

The total number of bytes written to the stream.

Public function setPosition(newPosition: TStreamOffset): TStreamOffset; override;

Set the current position within the stream.

This method sets the current position in the stream. If the position desired is within the buffer, then this method simply updates the current buffer position. Otherwise, the buffer is flushed and the underlying stream moved to the new position.

As with the inherited routine, newPosition may be a positive or negative value. If positive, newPosition refers to a position, in bytes, relative to the beginning of the stream. The first element in the stream is always at position zero (0). If negative, newPosition refers to a location, in bytes, relative to the end of the stream. The last element in the stream is always at position -1.

Returns

The previous position within the stream, relative to the beginning of the stream.


Generated by PasDoc 0.13.0 on 2015-06-23 19:40:11