Class: URLResponse

(package) rune.net.URLResponse()

The URLResponse class represents a response from a URLLoader. The class stores response data as URL Data (RFC2397), but can also encode to other data formats such as Audio, Image and JSON.

Constructor

(package) new URLResponse()

Creates a new instance of URLResponse. Note that new instances can only be created by URLLoader objects.
Source:

Members

(readonly) data :string

The raw data retrieved by the URLLoader object. Note that the data is according to the URL Data format (RFC2397).
Type:
  • string
Source:

(readonly) size :number

The size of the raw data in bytes. Note that the Base64 format is used to store the data and therefore compresses the file size compared to the original file.
Type:
  • number
Source:

(readonly) type :string

The content type of the retrieved raw data.
Type:
  • string
Source:

Methods

asAudio(handler, scopeopt) → {undefined}

Encodes response data into an Audio object.
Parameters:
Name Type Attributes Description
handler function Called when the encoding is complete.
scope Object <optional>
Scope of execution for the handler.
Source:
Returns:
Type
undefined

asEncodedResource(handler, scopeopt) → {undefined}

Encodes response data according to response type.
Parameters:
Name Type Attributes Description
handler function Called when the encoding is complete.
scope Object <optional>
Scope of execution for the handler.
Source:
Returns:
Type
undefined

asImage(handler, scopeopt) → {undefined}

Encodes response data into an Image object.
Parameters:
Name Type Attributes Description
handler function Called when the encoding is complete.
scope Object <optional>
Scope of execution for the handler.
Source:
Returns:
Type
undefined

asJSON(handler, scopeopt) → {undefined}

Encodes response data into an JSON object.
Parameters:
Name Type Attributes Description
handler function Called when the encoding is complete.
scope Object <optional>
Scope of execution for the handler.
Source:
Returns:
Type
undefined

asText(handler, scopeopt) → {undefined}

Encodes response data into a plain text string.
Parameters:
Name Type Attributes Description
handler function Called when the encoding is complete.
scope Object <optional>
Scope of execution for the handler.
Source:
Returns:
Type
undefined