Interface CanStream

DescriptionHierarchyFieldsMethodsProperties

Unit

Declaration

type CanStream = interface(IInterface)

Description

This interface declares the methods that must be implemented by any class that is capable of streaming its data.

Hierarchy

  • IInterface
  • CanStream

Overview

Methods

Public function streamingLength: TStreamIOSize;
Public function readFrom(const Source: AStream): TStreamIOSize;
Public function writeTo(const Dest: AStream): TStreamIOSize;

Description

Methods

Public function streamingLength: TStreamIOSize;

Determine the size of the data that will be streamed, in bytes.

Classes that implement this method should calculate the total size of the data that will be read from or written to a stream when either CanStream.readFrom or CanStream.writeTo is called.

Public function readFrom(const Source: AStream): TStreamIOSize;

Reads class data from \p Source. The class itself is responsible for validating that the information being read is pertinent to that class. This method is normally implemented to reverse the steps taken in CanStream.writeTo.

\return The number of bytes read from \p Source. This value may be zero (0) if \p Source is Nil or the data to be read from \p Source is not pertinent to the class.

Public function writeTo(const Dest: AStream): TStreamIOSize;

Writes class data to \p Dest. The nature and meaning of this data is defined by the class; usually, however, a class will implement this method in a way that will allow CanStream.readFrom to recall the information from the stream (by including length specifiers, checksums, etc.).

\return The number of bytes written to \p Dest. This value will be zero (0) if \Dest is Nil or an error occurred while writing.


Generated by PasDoc 0.13.0 on 2015-01-10 17:13:18