public class MobileFile extends MobileResource
mobileEndpoint, syncResource
Constructor and Description |
---|
MobileFile() |
Modifier and Type | Method and Description |
---|---|
void |
deleteResource(boolean deleteIfOffline,
MobileEndpointCallback callback)
Deletes the file
|
void |
deleteResource(MobileEndpointCallback callback)
Deletes the file.
|
void |
initialize(SyncResource syncResource,
MobileEndpoint mobileEndpoint,
java.io.InputStream dataStream,
java.lang.String contentType)
Creates a new MobileFile object with specified settings
|
java.io.InputStream |
openDataStream()
Gets the stream that can be used to read the file contents
|
void |
saveResource(java.io.InputStream dataStream,
java.lang.String contentType,
boolean saveIfOffline,
MobileEndpointCallback callback)
Saves any changes to the file back to the service.
|
void |
saveResource(java.io.InputStream dataStream,
java.lang.String contentType,
MobileEndpointCallback callback)
Saves any changes to the file back to the service.
|
getCurrentSyncPolicy, getLastSyncTime, getResponseHeaders, getSyncResource, getUri, hasConflict, hasOfflineCommitError, hasOfflineUpdates, isPinned, pinResource, reloadResource, reloadResource, setRequestHeaders, setSyncPolicy, unPinResource
public void initialize(SyncResource syncResource, MobileEndpoint mobileEndpoint, java.io.InputStream dataStream, java.lang.String contentType)
syncResource
- Sync ResourcemobileEndpoint
- MobileEndPoint APIdataStream
- The input streamcontentType
- The Content-Type of the streampublic java.io.InputStream openDataStream()
public void saveResource(java.io.InputStream dataStream, java.lang.String contentType, MobileEndpointCallback callback)
dataStream
- The stream whose contents are to be savedcontentType
- The Content-Type of the streamcallback
- MobileEndpointCallback object used to return result when request completespublic void saveResource(java.io.InputStream dataStream, java.lang.String contentType, boolean saveIfOffline, MobileEndpointCallback callback)
dataStream
- The stream whose contents are to be savedcontentType
- The Content-Type of the streamsaveIfOffline
- If the device is online, this parameter has no effect since any save will be written back to the server. If the device is offline and this option is true, the method will cache updates locally and, when the device returns online, sync them back to the remote service. If the device is offline and this option is false, the save will fail. Note the use of this function overrides any UpdatePolicy setting set elsewhere. This parameter is useful in cases such as a one-off save, where you can set the option to false to ensure the new/updated record is saved to MCS or an error is reported instantaneously, so you can immediately act on the result.callback
- MobileEndpointCallback object used to return result when request completespublic void deleteResource(MobileEndpointCallback callback)
callback
- MobileEndpointCallback object used to return result when request completespublic void deleteResource(boolean deleteIfOffline, MobileEndpointCallback callback)
deleteIfOffline
- If set to true, it will cache the delete locally and sync back to the service if the device is offline.
Otherwise, it will fail if the device is offlinecallback
- Callback