public class SyncService
extends java.lang.Object
To get a SyncService
object, use Device.getSyncService()
.
Modifier and Type | Class and Description |
---|---|
static class |
SyncService.FileStat |
static interface |
SyncService.ISyncProgressMonitor
Classes which implement this interface provide methods that deal
with displaying transfer progress.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes the connection.
|
static SyncService.ISyncProgressMonitor |
getNullProgressMonitor()
Returns a sync progress monitor that does nothing.
|
void |
pull(FileListingService.FileEntry[] entries,
java.lang.String localPath,
SyncService.ISyncProgressMonitor monitor)
Pulls file(s) or folder(s).
|
void |
pullFile(FileListingService.FileEntry remote,
java.lang.String localFilename,
SyncService.ISyncProgressMonitor monitor)
Pulls a single file.
|
void |
pullFile(java.lang.String remoteFilepath,
java.lang.String localFilename,
SyncService.ISyncProgressMonitor monitor)
Pulls a single file.
|
void |
push(java.lang.String[] local,
FileListingService.FileEntry remote,
SyncService.ISyncProgressMonitor monitor)
Push several files.
|
void |
pushFile(java.lang.String local,
java.lang.String remote,
SyncService.ISyncProgressMonitor monitor)
Push a single file.
|
SyncService.FileStat |
statFile(java.lang.String path)
Returns the stat info of the remote file.
|
public void close()
public static SyncService.ISyncProgressMonitor getNullProgressMonitor()
SyncService.ISyncProgressMonitor
.
This object can be reused multiple times and can be used by concurrent threads.
public void pull(FileListingService.FileEntry[] entries, java.lang.String localPath, SyncService.ISyncProgressMonitor monitor) throws SyncException, java.io.IOException, TimeoutException
entries
- the remote item(s) to pulllocalPath
- The local destination. If the entries count is > 1 or
if the unique entry is a folder, this should be a folder.monitor
- The progress monitor. Cannot be null.SyncException
java.io.IOException
TimeoutException
FileListingService.FileEntry
,
getNullProgressMonitor()
public void pullFile(FileListingService.FileEntry remote, java.lang.String localFilename, SyncService.ISyncProgressMonitor monitor) throws java.io.IOException, SyncException, TimeoutException
remote
- the remote filelocalFilename
- The local destination.monitor
- The progress monitor. Cannot be null.java.io.IOException
- in case of an IO exception.TimeoutException
- in case of a timeout reading responses from the device.SyncException
- in case of a sync exception.FileListingService.FileEntry
,
getNullProgressMonitor()
public void pullFile(java.lang.String remoteFilepath, java.lang.String localFilename, SyncService.ISyncProgressMonitor monitor) throws TimeoutException, java.io.IOException, SyncException
Because this method just deals with a String for the remote file instead of a
FileListingService.FileEntry
, the size of the file being pulled is unknown and the
SyncService.ISyncProgressMonitor
will not properly show the progress
remoteFilepath
- the full path to the remote filelocalFilename
- The local destination.monitor
- The progress monitor. Cannot be null.java.io.IOException
- in case of an IO exception.TimeoutException
- in case of a timeout reading responses from the device.SyncException
- in case of a sync exception.getNullProgressMonitor()
public void push(java.lang.String[] local, FileListingService.FileEntry remote, SyncService.ISyncProgressMonitor monitor) throws SyncException, java.io.IOException, TimeoutException
local
- An array of loca files to pushremote
- the remote FileListingService.FileEntry
representing a directory.monitor
- The progress monitor. Cannot be null.SyncException
- if file could not be pushedjava.io.IOException
- in case of I/O error on the connection.TimeoutException
- in case of a timeout reading responses from the device.public void pushFile(java.lang.String local, java.lang.String remote, SyncService.ISyncProgressMonitor monitor) throws SyncException, java.io.IOException, TimeoutException
local
- the local filepath.remote
- The remote filepath.monitor
- The progress monitor. Cannot be null.SyncException
- if file could not be pushedjava.io.IOException
- in case of I/O error on the connection.TimeoutException
- in case of a timeout reading responses from the device.@Nullable public SyncService.FileStat statFile(@NonNull java.lang.String path) throws TimeoutException, java.io.IOException
path
- the remote filejava.io.IOException
TimeoutException
- in case of a timeout reading responses from the device.