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
- TObject
- TUrlAsynchronousReader
Overview
Fields
Url: String; |
|
ForceSynchronous: Boolean; |
|
HttpMethod: THttpMethod; |
|
HttpPostData: TStrings; |
|
HttpHeadersKeys: TStrings; |
|
HttpHeadersValues: TStrings; |
|
HttpRequestBody: TMemoryStream; |
|
Status: TDownloadStatus; |
|
DownloadedBytes: Int64; |
|
TotalBytes: Int64; |
|
Contents: TStream; |
|
ErrorMessage: String; |
|
MimeType: String; |
|
HttpResponseCode: Integer; |
|
HttpResponseHeaders: TStrings; |
|
FinalUrl: String; |
Methods
function CheckNetworkAccess: Boolean; |
|
procedure Start; virtual; |
|
procedure Update; virtual; |
Description
Fields
Url: String; |
|
Fields set before Start is called. Should not be modified by this instance after Start. |
ForceSynchronous: Boolean; |
|
This item has no description. |
HttpMethod: THttpMethod; |
|
This item has no description. |
HttpPostData: TStrings; |
|
This item has no description. |
HttpHeadersKeys: TStrings; |
|
This item has no description. |
HttpHeadersValues: TStrings; |
|
This item has no description. |
HttpRequestBody: TMemoryStream; |
|
This item has no description. |
Status: TDownloadStatus; |
|
Fields that should be updated during downloading. They will set TCastleDownload properties of the same name. |
DownloadedBytes: Int64; |
|
This item has no description. |
TotalBytes: Int64; |
|
This item has no description. |
Contents: TStream; |
|
Not owned by this instance, TCastleDownload takes care of freeing this. |
ErrorMessage: String; |
|
When Status = dsError, download failed with this error. |
MimeType: String; |
|
May be updated at any point, even when dsDownloading, or only when dsSuccess. |
HttpResponseCode: Integer; |
|
This item has no description. |
HttpResponseHeaders: TStrings; |
|
In case of HTTP(S) requests, HTTP response code. |
FinalUrl: String; |
|
In case of HTTP(S) requests, this must contain HTTP response headers. |
Methods
function CheckNetworkAccess: Boolean; |
|
Call this from Start overrides in descendants that access the network. Call this after they called "inherited Start" which may change ForceSynchronous. This returns - It seems that we do synchronous download (maybe because we are called from Download(), or maybe we don't have thread support). - And EnableBlockingDownloads is IOW, this makes sure we honor EnableBlockingDownloads. When it sets |
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. |
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-snapshot.