|
CeresEngine 0.2.0
A game development framework
|
The metadata associated with the response to a URL load request, independent of protocol and URL scheme. More...
#include <CeresEngine/Foundation/IO/URLSession.hpp>
Public Member Functions | |
| IURLResponse (URLRequest request) | |
Creates a new URLResponse from a request. | |
| virtual | ~IURLResponse () noexcept=default |
Destroys the URLResponse. | |
| virtual URLInputStream | openInputStream ()=0 |
| Opens a new stream that can receive the data from the response. | |
| virtual URLOutputStream | openOutputStream () |
| Opens a new stream that can write the data from the response. | |
| virtual URLDataStream | openDataStream () |
| Opens a new stream that can read and write the data from the response. | |
| JSON | asJSON () |
| Opens the stream and reads it as a JSON file. | |
Public Attributes | |
| const URLRequest | request |
| The request that triggered the response. | |
| UInt64 | expectedContentLength = ~0ul |
| The expected length of the response's content. | |
| String | suggestedFileName = "" |
| A suggested filename for the response data. | |
| String | mimeType = "" |
| The MIME type of the response. | |
| String | textEncodingName = "" |
| The name of the text encoding provided by the response's originating source. | |
| UUID | contentID |
| A ID that uniquely represents a content. | |
The metadata associated with the response to a URL load request, independent of protocol and URL scheme.
URLResponse objects don't contain the actual bytes representing the content of a URL. Instead, the data is returned using DataStreams that can be fetched from the URLResponse.
|
inlineexplicit |
Creates a new URLResponse from a request.
| request | The request the response corresponds to. |
|
virtualdefaultnoexcept |
Destroys the URLResponse.
| JSON CeresEngine::IURLResponse::asJSON | ( | ) |
Opens the stream and reads it as a JSON file.
|
inlinevirtual |
Opens a new stream that can read and write the data from the response.
Not that not all protocols allow reading and writing data to the response.
Reimplemented in CeresEngine::FileURLProtocol::Response.
|
pure virtual |
Opens a new stream that can receive the data from the response.
Not that not all protocols allow calling this more than once.
Implemented in CeresEngine::FileURLProtocol::Response.
|
inlinevirtual |
Opens a new stream that can write the data from the response.
Not that not all protocols allow writing data to the response.
Reimplemented in CeresEngine::FileURLProtocol::Response.
| UUID CeresEngine::IURLResponse::contentID |
A ID that uniquely represents a content.
The content ID allows some protocols to implement improved caching, as well as reuse expensive operations between multiple requests that reference the same content ID. For example, a ZIP protocol can use the content ID to uniquely identify a ZIP file and thus allow to open the ZIP file just once and re-use the same handle for multiple requests.
| UInt64 CeresEngine::IURLResponse::expectedContentLength = ~0ul |
The expected length of the response's content.
This property's value is NSURLResponseUnknownLength if the length can't be determined.
Some protocol implementations report the content length as part of the response, but not all protocols guarantee to deliver that amount of data. Your app should be prepared to deal with more or less data.
| String CeresEngine::IURLResponse::mimeType = "" |
The MIME type of the response.
The MIME type is often provided by the response's originating source. However, that value may be changed or corrected by a protocol implementation if it can be determined that the response's source reported the information incorrectly.
If the response's originating source does not provide a MIME type, an attempt to guess the MIME type may be made.
| const URLRequest CeresEngine::IURLResponse::request |
The request that triggered the response.
| String CeresEngine::IURLResponse::suggestedFileName = "" |
A suggested filename for the response data.
Accessing this property attempts to generate a filename using the following information, in order:
If the host of URL can't be converted to a valid filename, the filename “unknown” is used. In most cases, this property appends the proper file extension based on the MIME type. Accessing this property always returns a valid filename regardless of whether the resource is saved to disk.
| String CeresEngine::IURLResponse::textEncodingName = "" |
The name of the text encoding provided by the response's originating source.
If no text encoding was provided by the protocol, this property's value is empty.