HttpFile

Description

sealed class Tinman.Core.IO.Files.HttpFile

Derived from

FileBase abstract

The HttpFile class is an implementation of the IFile interface that accesses a resource on a web server via HTTP/1.1 using byte range requests.

Usually, HttpFile objects are created indirectly via IFileSystem.FileNew of HttpFileSystem and are then accessed through the IFile interface.

Public / Constructors

Http­File


public constructor HttpFile → (5)

url in : string

[not-empty]
The URL of the web resource to access as a file.

http opt : ISimpleHttp own = null

The HTTP helper object to use or null to use a default SimpleHttp one.

path opt : Path = null

Optional Path value to use for this object. If null, Path.Unknown will be used.

length opt : int64 = -1

The file length, see IFile.GetLength. If negative, the file length will be obtained lazily with a HEAD request.

timestamp opt : int64 = Maths.MinLong

The file timestamp, see IFile.GetTimestamp. If equal to Maths.MinLong, the file timestamp will be obtained lazily with a HEAD request.

Creates a new instance of HttpFile.

The constructor will not perform any HTTP requests.

Public / Methods

Get­Metadata


public method GetMetadata → ()

Fetches file metadata via a HEAD request, if necessary.

This method is called automatically by IFile.GetLength and IFile.GetTimestamp. The fetched file metadata is cached until IFlushable.Flush is called.

IOException

If an I/O error has occurred.

Listing


public static method Listing → (1)

httpListing in : string

[not-null]
The URL to the uploaded listing file.

returns → SimpleHttpResult

The result of the HTTP request.

Calls HttpFileListing.Fetch with httpListing in and then delegates to ListingAdd, unless the listing is null.

This is a convenience helper for adding an HTTP listing globally for the whole duration the application is running.

Listing­Add


[ThreadSafe]
public static method ListingAdd → (1)

listing in : HttpFileListing

[not-null]
The HTTP listing to add.

Adds the given HttpFileListing.

Listing­Info


[ThreadSafe]
public static method ListingInfo → ()

returns → ISortedMapConst<string, int32>

The current HTTP listing data, where the map keys represent the relative URLs of the existing files and directories (trailing slashes indicate directories). The map value counts the number of active HttpFileListing objects that contain the entry.

Returns information about the current HTTP listing data.

Listing­Remove


[ThreadSafe]
public static method ListingRemove → (1)

listing in : HttpFileListing

[not-null]
The HTTP listing to remove.

Removes the given HttpFileListing.