upload_document_resumable
Description:
public UploadStream upload_document_resumable (DocumentsDocument? document, string slug, string content_type, int64 content_length, DocumentsUploadQuery? query, Cancellable? cancellable = null) throws Error
Uploads a document to Google Documents, using the properties from document
and the document data written to the resulting
UploadStream.
If the document data does not need to be provided at the moment, just the metadata, use insert_entry instead (e.g. in the case of creating a new, empty file to be edited at a later date).
Unlike upload_document, this method performs a resumable upload which allows for correction of transmission errors without re-uploading the entire file. Use of this method is preferred over upload_document.
If document
is null
, only the document data will be uploaded. The new document entry will be named using slug
, and will have default metadata.
If non-%NULL, the query
specifies parameters for the upload, such as a
DocumentsFolder to upload the document into; and whether to treat the document
as an opaque file, or convert it to a standard format. If query
is null
, the document will be uploaded into the root
folder, and automatically converted to a standard format. No OCR or automatic language translation will be performed by default.
If query
is non-%NULL and convert is false
, document
must be an instance of DocumentsDocument.
Otherwise, document
must be a subclass of it, such as
DocumentsPresentation.
The stream returned by this function should be written to using the standard
OutputStream methods, asynchronously or synchronously. Once the stream is closed (using
close),
finish_upload should be called on it to parse and return the
updated DocumentsDocument for the document. This must be done, as
document
isn't updated in-place.
In order to cancel the upload, a Cancellable passed in to cancellable
must be cancelled using cancel. Cancelling the individual
OutputStream operations on the
UploadStream will not cancel the entire upload; merely the write or close
operation in question. See the cancellable for more details.
Any upload errors will be thrown by the stream methods, and may come from the ServiceError domain.
Parameters:
this |
an authenticated DocumentsService |
document |
the DocumentsDocument to insert, or |
slug |
the filename to give to the uploaded document |
content_type |
the content type of the uploaded data |
content_length |
the size (in bytes) of the file being uploaded |
query |
a query specifying parameters for the upload, or |
cancellable |
a Cancellable for the entire upload stream, or |
Returns:
a UploadStream to write the document data to, or |