Class TUrlAsynchronousReader

Unit

Declaration

type TUrlAsynchronousReader = class(TObject)

Description

Implement this class, and pass to RegisterUrlProtocol, to read protocols asynchronously (such that TCastleDownload can read them asynchronously).

There is no point in using this class unless you want to handle custom URL protocols. If you just want to download asynchronously from standard URLs, like file or http, then use TCastleDownload class.

Hierarchy

Overview

Fields

Public Url: String;
Public ForceSynchronous: Boolean;
Public HttpMethod: THttpMethod;
Public HttpPostData: TStrings;
Public HttpHeadersKeys: TStrings;
Public HttpHeadersValues: TStrings;
Public Status: TDownloadStatus;
Public DownloadedBytes: Int64;
Public TotalBytes: Int64;
Public Contents: TStream;
Public ErrorMessage: String;
Public MimeType: String;
Public HttpResponseCode: Integer;
Public HttpResponseHeaders: TStrings;
Public FinalUrl: String;

Methods

Public procedure Start; virtual;
Public procedure Update; virtual;

Description

Fields

Public Url: String;

Fields set before Start is called. Should not be modified by this instance after Start.

Public ForceSynchronous: Boolean;
 
Public HttpMethod: THttpMethod;
 
Public HttpPostData: TStrings;
 
Public HttpHeadersKeys: TStrings;
 
Public HttpHeadersValues: TStrings;
 
Public Status: TDownloadStatus;

Fields that should be updated during downloading. They will set TCastleDownload properties of the same name.

Public DownloadedBytes: Int64;
 
Public TotalBytes: Int64;
 
Public Contents: TStream;

Not owned by this instance, TCastleDownload takes care of freeing this.

Public ErrorMessage: String;

When Status = dsError, download failed with this error.

Public MimeType: String;

May be updated at any point, even when dsDownloading, or only when dsSuccess.

Public HttpResponseCode: Integer;
 
Public HttpResponseHeaders: TStrings;

In case of HTTP(S) requests, HTTP response code.

Public FinalUrl: String;

In case of HTTP(S) requests, this must contain HTTP response headers.

Methods

Public procedure Start; virtual;

Start downloading, called when TCastleDownload.Start is called.

Note for descendant implementors: Exceptions raised inside this will make an actual exception from TCastleDownload.Start. In case of normal download failure, e.g. file (or HTTP resource) doesn't exist (so it is not some bug in code), this method should set Status to dsError and not raise an exception.

Public procedure Update; virtual;

Called continuously to push the download further.

Note for descendant implementors: Exceptions raised inside this will make an actual exception (from undefined place, for now ApplicationProperties._Update, called by TCastleWindow and TCastleControl). In case of normal download failure, e.g. file (or HTTP resource) doesn't exist (so it is not some bug in code), this method should set Status to dsError and not raise an exception.


Generated by PasDoc 0.16.0.