download

abstract fun download(fileLink: FileLink, sink: DataSink): Call<Void>

Download a FileLink to a specified destination.

Same as calling download with a null listener.

Return

a void Call which will return on success, or report an error otherwise.

See also

Parameters

fileLink

the file link to be downloaded. Must not be null.

sink

the sink that will receive the data. Must not be null.

Throws

on a null sink argument.


abstract fun download(fileLink: FileLink, sink: DataSink, listener: ProgressListener): Call<Void>

Download a FileLink to a specified destination.

This call will get attempt to download the contents of the file that the provided fileLink object was created for, optionally notifying about the progress via a provided ProgressListener. The content bytes will be delivered though the DataSink object.

See progressCallbackThreshold for details on how to control the progress notifications rate.

If set via callbackExecutor, the progress listener's methods will be scheduled on the provided Executor.

Refer to the file links documentation page for details on any ApiError errors.

Return

a void Call which will return on success, or report an error otherwise.

See also

Parameters

fileLink

the file link to be downloaded. Must not be null.

sink

the sink that will receive the data. Must not be null.

listener

an optional listener that will get notified on progress. If null, no progress will be reported.

Throws

on a null sink argument.


abstract fun download(file: RemoteFile): Call<BufferedSource>

Get the content of a specified remote file.

This call is a shorthand for obtaining a FileLink object via createFileLink with DEFAULT, then using it with the download method.

Refer to the file links documentation page for details on any ApiError errors.

NOTE: It is the caller's responsibility to close the resulting object or resource leaks will occur.

Return

Call which results in a bytes source

See also

Parameters

file

target file. Must not be null.

Throws

on a null file argument.


abstract fun download(fileLink: FileLink): Call<BufferedSource>

Get the content of a specified file link.

Upon success, this call will return a bytes source of the file that the provided fileLink object was created for.

Refer to the file links documentation page for details on any ApiError errors.

NOTE: It is the caller's responsibility to close the resulting object or resource leaks will occur.

Return

Call which results in a bytes source

Parameters

fileLink

the file link to be downloaded. Must not be null.

Throws

on a null fileLink argument.