C# Class Google.GData.Client.ResumableUpload.ResumableUploader

this class handles the Resumable Upload protocol
Inheritance: AsyncDataHandler
Show file Open project: moljac/MonoMobile.Google.GData Class Usage Examples

Public Properties

Property Type Description
CreateMediaRelation string
EditMediaRelation string

Public Methods

Method Description
GetResumableCreateUri ( AtomLinkCollection links ) : Uri

returns the resumabled create media Uri for a given entry

GetResumableEditUri ( AtomLinkCollection links ) : Uri

returns the resumable edit media Uri for a given entry

InitiateUpload ( Uri resumableUploadUri, Authenticator authentication, AbstractEntry entry ) : Uri

retrieves the resumable URI for the rest of the operation. This will initiate the communication with resumable upload server by posting against the starting URI

InitiateUpload ( Uri resumableUploadUri, Authenticator authentication, AbstractEntry entry, string httpMethod ) : Uri

retrieves the resumable URI for the rest of the operation. This will initiate the communication with resumable upload server by posting against the starting URI

InitiateUpload ( Uri resumableUploadUri, Authenticator authentication, string contentType, string slug, long contentLength ) : Uri

retrieves the resumable URI for the rest of the operation. This will initiate the communication with resumable upload server by posting against the starting URI

InitiateUpload ( Uri resumableUploadUri, Authenticator authentication, string contentType, string slug, long contentLength, string httpMethod ) : Uri

retrieves the resumable URI for the rest of the operation. This will initiate the communication with resumable upload server by posting against the starting URI

Insert ( Authenticator authentication, AbstractEntry payload ) : WebResponse

Uploads an entry, including it's media to the uri given inside the entry.

Insert ( Authenticator authentication, Uri resumableUploadUri, Stream payload, string contentType, string slug ) : WebResponse

Uploads just the media media to the uri given.

InsertAsync ( Authenticator authentication, AbstractEntry payload, object userData ) : void
InsertAsync ( Authenticator authentication, Uri resumableUploadUri, Stream payload, string contentType, string slug, object userData ) : void
QueryStatus ( Authenticator authentication, Uri targetUri ) : long

asks the server about the current status

ResumableUploader ( ) : System

Default constructor. Uses the default chunksize of 25 megabyte

ResumableUploader ( int chunkSize ) : System

ResumableUploader constructor.

Resume ( Authenticator authentication, Uri resumeUri, String httpMethod, Stream payload, string contentType ) : WebResponse
ResumeAsync ( Authenticator authentication, Uri resumeUri, String httpmethod, Stream payload, string contentType, object userData ) : void
Update ( Authenticator authentication, AbstractEntry payload ) : WebResponse

Uploads an entry, including its media to the uri given inside the entry

Update ( Authenticator authentication, Uri resumableUploadUri, Stream payload, string contentType ) : WebResponse

Uploads just the media to the uri given.

UpdateAsync ( Authenticator authentication, AbstractEntry payload, object userData ) : void
UpdateAsync ( Authenticator authentication, Uri resumableUploadUri, Stream payload, string contentType, object userData ) : void
UploadStream ( string httpMethod, Uri sessionUri, Authenticator authentication, Stream payload, string mediaType, AsyncData data ) : WebResponse

Note the URI passed in here, is the session URI obtained by InitiateUpload

Protected Methods

Method Description
CopyData ( Stream input, HttpWebRequest request, int partIndex, AsyncData data, Uri requestId ) : bool

takes our copy of the stream, and puts it into the request stream returns FALSE when we are done by reaching the end of the input stream

Private Methods

Method Description
AsyncInsertWorker ( AsyncResumableUploadData data, AsyncOperation asyncOp, SendOrPostCallback completionMethodDelegate ) : void

worker method for the the resumable insert

AsyncResumeWorker ( AsyncResumableUploadData data, AsyncOperation asyncOp, SendOrPostCallback completionMethodDelegate ) : void

worker method to handle the resume operation

AsyncStarter ( AsyncResumableUploadData data, WorkerResumableUploadHandler workerDelegate, Object userData ) : void

starts the async job

AsyncUpdateWorker ( AsyncResumableUploadData data, AsyncOperation asyncOp, SendOrPostCallback completionMethodDelegate ) : void

worker method for the resumable update

GetStreamLength ( Stream s ) : long
Insert ( Authenticator authentication, AbstractEntry payload, AsyncData data ) : WebResponse
Insert ( Authenticator authentication, Uri resumableUploadUri, Stream payload, string contentType, string slug, AsyncData data ) : WebResponse
PrepareRequest ( Uri target, Authenticator authentication, string slug, string contentType, long contentLength ) : HttpWebRequest
PrepareRequest ( Uri target, Authenticator authentication, string slug, string contentType, long contentLength, string httpMethod ) : HttpWebRequest
Resume ( Authenticator authentication, Uri resumeUri, String httpmethod, Stream payload, string contentType, AsyncData data ) : WebResponse
Update ( Authenticator authentication, AbstractEntry payload, AsyncData data ) : WebResponse
Update ( Authenticator authentication, Uri resumableUploadUri, Stream payload, string contentType, AsyncData data ) : WebResponse
UploadStreamPart ( int partIndex, string httpMethod, Uri sessionUri, Authenticator authentication, Stream payload, string mediaType, AsyncData data ) : HttpWebResponse

Method Details

CopyData() protected method

takes our copy of the stream, and puts it into the request stream returns FALSE when we are done by reaching the end of the input stream
protected CopyData ( Stream input, HttpWebRequest request, int partIndex, AsyncData data, Uri requestId ) : bool
input Stream
request System.Net.HttpWebRequest
partIndex int
data AsyncData
requestId System.Uri
return bool

GetResumableCreateUri() public static method

returns the resumabled create media Uri for a given entry
public static GetResumableCreateUri ( AtomLinkCollection links ) : Uri
links AtomLinkCollection
return System.Uri

GetResumableEditUri() public static method

returns the resumable edit media Uri for a given entry
public static GetResumableEditUri ( AtomLinkCollection links ) : Uri
links AtomLinkCollection
return System.Uri

InitiateUpload() public method

retrieves the resumable URI for the rest of the operation. This will initiate the communication with resumable upload server by posting against the starting URI
public InitiateUpload ( Uri resumableUploadUri, Authenticator authentication, AbstractEntry entry ) : Uri
resumableUploadUri System.Uri
authentication Authenticator
entry AbstractEntry
return System.Uri

InitiateUpload() public method

retrieves the resumable URI for the rest of the operation. This will initiate the communication with resumable upload server by posting against the starting URI
public InitiateUpload ( Uri resumableUploadUri, Authenticator authentication, AbstractEntry entry, string httpMethod ) : Uri
resumableUploadUri System.Uri
authentication Authenticator
entry AbstractEntry
httpMethod string
return System.Uri

InitiateUpload() public method

retrieves the resumable URI for the rest of the operation. This will initiate the communication with resumable upload server by posting against the starting URI
public InitiateUpload ( Uri resumableUploadUri, Authenticator authentication, string contentType, string slug, long contentLength ) : Uri
resumableUploadUri System.Uri
authentication Authenticator
contentType string
slug string
contentLength long
return System.Uri

InitiateUpload() public method

retrieves the resumable URI for the rest of the operation. This will initiate the communication with resumable upload server by posting against the starting URI
public InitiateUpload ( Uri resumableUploadUri, Authenticator authentication, string contentType, string slug, long contentLength, string httpMethod ) : Uri
resumableUploadUri System.Uri
authentication Authenticator
contentType string
slug string
contentLength long
httpMethod string
return System.Uri

Insert() public method

Uploads an entry, including it's media to the uri given inside the entry.
public Insert ( Authenticator authentication, AbstractEntry payload ) : WebResponse
authentication Authenticator The authentication information to be used
payload AbstractEntry The entry to be uploaded. This is a complete entry, including the metadata. /// This will create a new entry on the service
return System.Net.WebResponse

Insert() public method

Uploads just the media media to the uri given.
public Insert ( Authenticator authentication, Uri resumableUploadUri, Stream payload, string contentType, string slug ) : WebResponse
authentication Authenticator The authentication information to be used
resumableUploadUri System.Uri
payload Stream The media to uploaded.
contentType string The type of the content, e.g. text/html
slug string
return System.Net.WebResponse

InsertAsync() public method

public InsertAsync ( Authenticator authentication, AbstractEntry payload, object userData ) : void
authentication Authenticator
payload AbstractEntry
userData object
return void

InsertAsync() public method

public InsertAsync ( Authenticator authentication, Uri resumableUploadUri, Stream payload, string contentType, string slug, object userData ) : void
authentication Authenticator
resumableUploadUri System.Uri
payload Stream
contentType string
slug string
userData object
return void

QueryStatus() public static method

asks the server about the current status
public static QueryStatus ( Authenticator authentication, Uri targetUri ) : long
authentication Authenticator
targetUri System.Uri
return long

ResumableUploader() public method

Default constructor. Uses the default chunksize of 25 megabyte
public ResumableUploader ( ) : System
return System

ResumableUploader() public method

ResumableUploader constructor.
public ResumableUploader ( int chunkSize ) : System
chunkSize int the upload chunksize in Megabytes, needs to be greater than 0
return System

Resume() public method

public Resume ( Authenticator authentication, Uri resumeUri, String httpMethod, Stream payload, string contentType ) : WebResponse
authentication Authenticator
resumeUri System.Uri
httpMethod String
payload Stream
contentType string
return System.Net.WebResponse

ResumeAsync() public method

public ResumeAsync ( Authenticator authentication, Uri resumeUri, String httpmethod, Stream payload, string contentType, object userData ) : void
authentication Authenticator
resumeUri System.Uri
httpmethod String
payload Stream
contentType string
userData object
return void

Update() public method

Uploads an entry, including its media to the uri given inside the entry
public Update ( Authenticator authentication, AbstractEntry payload ) : WebResponse
authentication Authenticator The authentication information to be used
payload AbstractEntry The entry to be uploaded. This is a complete entry, including the metadata. /// This will create a new entry on the service
return System.Net.WebResponse

Update() public method

Uploads just the media to the uri given.
public Update ( Authenticator authentication, Uri resumableUploadUri, Stream payload, string contentType ) : WebResponse
authentication Authenticator The authentication information to be used
resumableUploadUri System.Uri
payload Stream The media to uploaded.
contentType string The type of the content, e.g. text/html
return System.Net.WebResponse

UpdateAsync() public method

public UpdateAsync ( Authenticator authentication, AbstractEntry payload, object userData ) : void
authentication Authenticator
payload AbstractEntry
userData object
return void

UpdateAsync() public method

public UpdateAsync ( Authenticator authentication, Uri resumableUploadUri, Stream payload, string contentType, object userData ) : void
authentication Authenticator
resumableUploadUri System.Uri
payload Stream
contentType string
userData object
return void

UploadStream() public method

Note the URI passed in here, is the session URI obtained by InitiateUpload
public UploadStream ( string httpMethod, Uri sessionUri, Authenticator authentication, Stream payload, string mediaType, AsyncData data ) : WebResponse
httpMethod string
sessionUri System.Uri
authentication Authenticator
payload Stream
mediaType string
data AsyncData
return System.Net.WebResponse

Property Details

CreateMediaRelation public static property

The relationship value to be used to find the resumable
public static string CreateMediaRelation
return string

EditMediaRelation public static property

public static string EditMediaRelation
return string