JubeatPlus 3.9.11
Loading...
Searching...
No Matches
Downloader Class Reference

A one-shot HTTP request that reports its result to a delegate. More...

#include <Downloader.h>

Inheritance diagram for Downloader:
Collaboration diagram for Downloader:

Instance Methods

(instancetype) - initWithURL:delegate:
 Builds a plain GET.
(instancetype) - initWithURL:postJsonData:delegate:
 Builds a JSON POST.
(instancetype) - initWithURL:postData:delegate:
 Builds a POST with an arbitrary body.
(void) - startDownloading
 Starts the request.
(void) - cancel
 Abandons the request.
(void) - connectionCancel
 Cancels the current session task and clears it.
(unsigned long long) - currentSize
 The total bytes downloaded so far.
(float) - currentProgress
 The fraction of the expected total that has arrived.
(nullable NSData *) - getData
 The body the request returned.
(nullable NSDictionary *) - getDataInJSON
 The body the request returned, parsed as JSON.

Public Attributes

NSURLRequest * request
 The request being run.
NSURLSession * session
 The session the request runs on.
NSURLSessionTask * sessionTask
 The task carrying the request.
NSMutableData * data
 The response body accumulated so far.
int64_t dl_size
 The total byte count the response declared.
__weak id< DownloaderDelegate > delegate
 The object told how the request finished.
int _tag
 The caller's tag, distinguishing concurrent requests sharing one delegate.

Properties

int tag
 An integer tag the caller may attach to the request.

Detailed Description

A one-shot HTTP request that reports its result to a delegate.

Method Documentation

◆ cancel

- (void) cancel

Abandons the request.

Clears the weak delegate, cancels the session task, and drops the accumulated data.

Ghidra address:
0xa83a4
Ghidra address:
0xa83a4

◆ connectionCancel

- (void) connectionCancel

Cancels the current session task and clears it.

Ghidra address:
0xa88e0

◆ currentProgress

- (float) currentProgress

The fraction of the expected total that has arrived.

Returns
Progress in [0,1], or 0 when the expected length is unknown or already exceeded.
Ghidra address:
0xa8728
Ghidra address:
0xa8728

◆ currentSize

- (unsigned long long) currentSize

The total bytes downloaded so far.

Returns
The length of the accumulated data, or 0 when none.
Ghidra address:
0xa8710
Ghidra address:
0xa8710

◆ getData

- (NSData *) getData

The body the request returned.

Returns
The downloaded bytes, or nil before completion.
Ghidra address:
0xa8794
Ghidra address:
0xa8794

◆ getDataInJSON

- (NSDictionary *) getDataInJSON

The body the request returned, parsed as JSON.

Returns nil rather than raising when the body is missing or will not parse, which is what -[LogoViewController downloaderFinished:] tests before reading any key out of it.

Returns
The parsed body, or nil.
Ghidra address:
0xa87a4
Ghidra address:
0xa87a4

◆ initWithURL:delegate:

- (instancetype) initWithURL: (NSURL *) url
delegate: (nullable id< DownloaderDelegate >) delegate 

Builds a plain GET.

Parameters
urlThe endpoint.
delegateThe object to report completion to, or nil. Stored weakly.
Returns
The initialised request.
Ghidra address:
0xa7d4c

◆ initWithURL:postData:delegate:

- (instancetype) initWithURL: (NSURL *) url
postData: (NSData *) postData
delegate: (nullable id< DownloaderDelegate >) delegate 

Builds a POST with an arbitrary body.

Parameters
urlThe endpoint.
postDataThe request body.
delegateThe object to report completion to, or nil. Stored weakly.
Returns
The initialised request.
Ghidra address:
0xa80a8

◆ initWithURL:postJsonData:delegate:

- (instancetype) initWithURL: (NSURL *) url
postJsonData: (NSData *) jsonData
delegate: (nullable id< DownloaderDelegate >) delegate 

Builds a JSON POST.

Parameters
urlThe endpoint.
jsonDataThe serialised request body.
delegateThe object to report completion to, or nil. Stored weakly.
Returns
The initialised request.
Ghidra address:
0xa7e9c

◆ startDownloading

- (void) startDownloading

Starts the request.

Cancels any previous session task first, then creates a new NSURLSession on the main queue and resumes its data task.

Ghidra address:
0xa8298
Ghidra address:
0xa8298

Property Documentation

◆ tag

- (int) tag
readwritenonatomicassign

An integer tag the caller may attach to the request.

Ghidra address:
0xa891c

The documentation for this class was generated from the following files: