Class ABufferedInputStream

DescriptionHierarchyFieldsMethodsProperties

Unit

Declaration

type ABufferedInputStream = class(ABufferedStream)

Description

This class wraps around an input stream and buffers input from that stream.

Hierarchy

Overview

Methods

Protected function refreshBuffer: TStreamIOSize; override;
Public function read(const count: TStreamIOSize; var dest): TStreamIOSize; override;
Public function rewindBy(count: TStreamIOSize): TStreamOffset; override;
Public function setPosition(newPosition: TStreamOffset): TStreamOffset; override;

Description

Methods

Protected function refreshBuffer: TStreamIOSize; override;

Refresh the buffer.

This method reads from the underlying stream into the buffer and returns the total number of bytes read. If the underlying stream indicates that the end of the stream has already been reached, then this method does nothing.

Returns

The total number of bytes read from the underlying stream. If the end of the stream was reached before this method was called, then this value will be zero (0).

Public function read(const count: TStreamIOSize; var dest): TStreamIOSize; override;

Read count bytes from the buffer and store the data in dest.

This method retrieves data first from the buffer. If the end of the buffer is reached before count bytes can be returned, then the target stream is queried for more data and the buffer is refilled, if possible.

Returns

The total number of bytes read from the stream. This value may be less than count if the end of the stream was encountered while reading.

Public function rewindBy(count: TStreamIOSize): TStreamOffset; override;

Rewind the stream position pointer by the specified number of bytes.

If the number of bytes specified falls within the buffer, this method simply updates the buffer position. Otherwise, it queries the stream for more information and the buffer is reloaded.

Returns

The previous position within the stream, in bytes relative to the beginning of 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 underlying stream is queried for more data and the buffer is reloaded, beginning at the position specified by newPosition.

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-01-10 17:13:18