本文整理汇总了Java中com.android.ddmlib.SyncException.SyncError类的典型用法代码示例。如果您正苦于以下问题:Java SyncError类的具体用法?Java SyncError怎么用?Java SyncError使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SyncError类属于com.android.ddmlib.SyncException包,在下文中一共展示了SyncError类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: pull
import com.android.ddmlib.SyncException.SyncError; //导入依赖的package包/类
/**
* Pulls file(s) or folder(s).
* @param entries the remote item(s) to pull
* @param localPath The local destination. If the entries count is > 1 or
* if the unique entry is a folder, this should be a folder.
* @param monitor The progress monitor. Cannot be null.
* @throws SyncException
* @throws IOException
* @throws TimeoutException
*
* @see FileListingService.FileEntry
* @see #getNullProgressMonitor()
*/
public void pull(FileEntry[] entries, String localPath, ISyncProgressMonitor monitor)
throws SyncException, IOException, TimeoutException {
// first we check the destination is a directory and exists
File f = new File(localPath);
if (!f.exists()) {
throw new SyncException(SyncError.NO_DIR_TARGET);
}
if (!f.isDirectory()) {
throw new SyncException(SyncError.TARGET_IS_FILE);
}
// get a FileListingService object
FileListingService fls = new FileListingService(mDevice);
// compute the number of file to move
int total = getTotalRemoteFileSize(entries, fls);
// start the monitor
monitor.start(total);
doPull(entries, localPath, fls, monitor);
monitor.stop();
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:39,代码来源:SyncService.java
示例2: pullFile
import com.android.ddmlib.SyncException.SyncError; //导入依赖的package包/类
/**
* Pulls a single file.
* <p/>Because this method just deals with a String for the remote file instead of a
* {@link FileEntry}, the size of the file being pulled is unknown and the
* {@link ISyncProgressMonitor} will not properly show the progress
* @param remoteFilepath the full path to the remote file
* @param localFilename The local destination.
* @param monitor The progress monitor. Cannot be null.
*
* @throws IOException in case of an IO exception.
* @throws TimeoutException in case of a timeout reading responses from the device.
* @throws SyncException in case of a sync exception.
*
* @see #getNullProgressMonitor()
*/
public void pullFile(String remoteFilepath, String localFilename,
ISyncProgressMonitor monitor) throws TimeoutException, IOException, SyncException {
Integer mode = readMode(remoteFilepath);
if (mode == null) {
// attempts to download anyway
} else if (mode == 0) {
throw new SyncException(SyncError.NO_REMOTE_OBJECT);
}
monitor.start(0);
//TODO: use the {@link FileListingService} to get the file size.
doPullFile(remoteFilepath, localFilename, monitor);
monitor.stop();
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:32,代码来源:SyncService.java
示例3: push
import com.android.ddmlib.SyncException.SyncError; //导入依赖的package包/类
/**
* Push several files.
* @param local An array of loca files to push
* @param remote the remote {@link FileEntry} representing a directory.
* @param monitor The progress monitor. Cannot be null.
* @throws SyncException if file could not be pushed
* @throws IOException in case of I/O error on the connection.
* @throws TimeoutException in case of a timeout reading responses from the device.
*/
public void push(String[] local, FileEntry remote, ISyncProgressMonitor monitor)
throws SyncException, IOException, TimeoutException {
if (!remote.isDirectory()) {
throw new SyncException(SyncError.REMOTE_IS_FILE);
}
// make a list of File from the list of String
ArrayList<File> files = new ArrayList<File>();
for (String path : local) {
files.add(new File(path));
}
// get the total count of the bytes to transfer
File[] fileArray = files.toArray(new File[files.size()]);
int total = getTotalLocalFileSize(fileArray);
monitor.start(total);
doPush(fileArray, remote.getFullPath(), monitor);
monitor.stop();
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:32,代码来源:SyncService.java
示例4: pushFile
import com.android.ddmlib.SyncException.SyncError; //导入依赖的package包/类
/**
* Push a single file.
* @param local the local filepath.
* @param remote The remote filepath.
* @param monitor The progress monitor. Cannot be null.
*
* @throws SyncException if file could not be pushed
* @throws IOException in case of I/O error on the connection.
* @throws TimeoutException in case of a timeout reading responses from the device.
*/
public void pushFile(String local, String remote, ISyncProgressMonitor monitor)
throws SyncException, IOException, TimeoutException {
File f = new File(local);
if (!f.exists()) {
throw new SyncException(SyncError.NO_LOCAL_FILE);
}
if (f.isDirectory()) {
throw new SyncException(SyncError.LOCAL_IS_DIRECTORY);
}
monitor.start((int)f.length());
doPushFile(local, remote, monitor);
monitor.stop();
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:28,代码来源:SyncService.java
示例5: doPush
import com.android.ddmlib.SyncException.SyncError; //导入依赖的package包/类
/**
* Push multiple files
* @param fileArray
* @param remotePath
* @param monitor
*
* @throws SyncException if file could not be pushed
* @throws IOException in case of I/O error on the connection.
* @throws TimeoutException in case of a timeout reading responses from the device.
*/
private void doPush(File[] fileArray, String remotePath, ISyncProgressMonitor monitor)
throws SyncException, IOException, TimeoutException {
for (File f : fileArray) {
// check if we're canceled
if (monitor.isCanceled()) {
throw new SyncException(SyncError.CANCELED);
}
if (f.exists()) {
if (f.isDirectory()) {
// append the name of the directory to the remote path
String dest = remotePath + "/" + f.getName(); // $NON-NLS-1S
monitor.startSubTask(dest);
doPush(f.listFiles(), dest, monitor);
monitor.advance(1);
} else if (f.isFile()) {
// append the name of the file to the remote path
String remoteFile = remotePath + "/" + f.getName(); // $NON-NLS-1S
monitor.startSubTask(remoteFile);
doPushFile(f.getAbsolutePath(), remoteFile, monitor);
}
}
}
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:35,代码来源:SyncService.java
示例6: pull
import com.android.ddmlib.SyncException.SyncError; //导入依赖的package包/类
/**
* Pulls file(s) or folder(s).
* @param entries the remote item(s) to pull
* @param localPath The local destination. If the entries count is > 1 or
* if the unique entry is a folder, this should be a folder.
* @param monitor The progress monitor. Cannot be null.
* @throws SyncException
* @throws IOException
* @throws TimeoutException
*
* @see FileListingService.FileEntry
* @see #getNullProgressMonitor()
*/
public void pull(FileEntry[] entries, String localPath, ISyncProgressMonitor monitor)
throws SyncException, IOException, TimeoutException {
// first we check the destination is a directory and exists
File f = new File(localPath);
if (f.exists() == false) {
throw new SyncException(SyncError.NO_DIR_TARGET);
}
if (f.isDirectory() == false) {
throw new SyncException(SyncError.TARGET_IS_FILE);
}
// get a FileListingService object
FileListingService fls = new FileListingService(mDevice);
// compute the number of file to move
int total = getTotalRemoteFileSize(entries, fls);
// start the monitor
monitor.start(total);
doPull(entries, localPath, fls, monitor);
monitor.stop();
}
开发者ID:utds3lab,项目名称:SMVHunter,代码行数:39,代码来源:SyncService.java
示例7: push
import com.android.ddmlib.SyncException.SyncError; //导入依赖的package包/类
/**
* Push several files.
* @param local An array of loca files to push
* @param remote the remote {@link FileEntry} representing a directory.
* @param monitor The progress monitor. Cannot be null.
* @throws SyncException if file could not be pushed
* @throws IOException in case of I/O error on the connection.
* @throws TimeoutException in case of a timeout reading responses from the device.
*/
public void push(String[] local, FileEntry remote, ISyncProgressMonitor monitor)
throws SyncException, IOException, TimeoutException {
if (remote.isDirectory() == false) {
throw new SyncException(SyncError.REMOTE_IS_FILE);
}
// make a list of File from the list of String
ArrayList<File> files = new ArrayList<File>();
for (String path : local) {
files.add(new File(path));
}
// get the total count of the bytes to transfer
File[] fileArray = files.toArray(new File[files.size()]);
int total = getTotalLocalFileSize(fileArray);
monitor.start(total);
doPush(fileArray, remote.getFullPath(), monitor);
monitor.stop();
}
开发者ID:utds3lab,项目名称:SMVHunter,代码行数:32,代码来源:SyncService.java
示例8: pushFile
import com.android.ddmlib.SyncException.SyncError; //导入依赖的package包/类
/**
* Push a single file.
* @param local the local filepath.
* @param remote The remote filepath.
* @param monitor The progress monitor. Cannot be null.
*
* @throws SyncException if file could not be pushed
* @throws IOException in case of I/O error on the connection.
* @throws TimeoutException in case of a timeout reading responses from the device.
*/
public void pushFile(String local, String remote, ISyncProgressMonitor monitor)
throws SyncException, IOException, TimeoutException {
File f = new File(local);
if (f.exists() == false) {
throw new SyncException(SyncError.NO_LOCAL_FILE);
}
if (f.isDirectory()) {
throw new SyncException(SyncError.LOCAL_IS_DIRECTORY);
}
monitor.start((int)f.length());
doPushFile(local, remote, monitor);
monitor.stop();
}
开发者ID:utds3lab,项目名称:SMVHunter,代码行数:28,代码来源:SyncService.java
示例9: doPush
import com.android.ddmlib.SyncException.SyncError; //导入依赖的package包/类
/**
* Push multiple files
* @param fileArray
* @param remotePath
* @param monitor
*
* @throws SyncException if file could not be pushed
* @throws IOException in case of I/O error on the connection.
* @throws TimeoutException in case of a timeout reading responses from the device.
*/
private void doPush(File[] fileArray, String remotePath, ISyncProgressMonitor monitor)
throws SyncException, IOException, TimeoutException {
for (File f : fileArray) {
// check if we're canceled
if (monitor.isCanceled() == true) {
throw new SyncException(SyncError.CANCELED);
}
if (f.exists()) {
if (f.isDirectory()) {
// append the name of the directory to the remote path
String dest = remotePath + "/" + f.getName(); // $NON-NLS-1S
monitor.startSubTask(dest);
doPush(f.listFiles(), dest, monitor);
monitor.advance(1);
} else if (f.isFile()) {
// append the name of the file to the remote path
String remoteFile = remotePath + "/" + f.getName(); // $NON-NLS-1S
monitor.startSubTask(remoteFile);
doPushFile(f.getAbsolutePath(), remoteFile, monitor);
}
}
}
}
开发者ID:utds3lab,项目名称:SMVHunter,代码行数:35,代码来源:SyncService.java
示例10: doPush
import com.android.ddmlib.SyncException.SyncError; //导入依赖的package包/类
/**
* Push multiple files
* @param fileArray
* @param remotePath
* @param monitor
*
* @throws SyncException if file could not be pushed
* @throws IOException in case of I/O error on the connection.
* @throws TimeoutException in case of a timeout reading responses from the device.
*/
public void doPush(File[] fileArray, String remotePath, ISyncProgressMonitor monitor)
throws SyncException, IOException, TimeoutException {
for (File f : fileArray) {
// check if we're canceled
if (monitor.isCanceled() == true) {
throw new SyncException(SyncError.CANCELED);
}
if (f.exists()) {
if (f.isDirectory()) {
// append the name of the directory to the remote path
String dest = remotePath + "/" + f.getName(); // $NON-NLS-1S
monitor.startSubTask(dest);
doPush(f.listFiles(), dest, monitor);
monitor.advance(1);
} else if (f.isFile()) {
// append the name of the file to the remote path
String remoteFile = remotePath + "/" + f.getName(); // $NON-NLS-1S
monitor.startSubTask(remoteFile);
doPushFile(f.getAbsolutePath(), remoteFile, monitor);
}
}
}
}
开发者ID:lrscp,项目名称:ControlAndroidDeviceFromPC,代码行数:35,代码来源:SyncService.java
示例11: pushFiles
import com.android.ddmlib.SyncException.SyncError; //导入依赖的package包/类
public void pushFiles(Shell parent, final String[] local, final File remote,
final Runnable callBack) {
try {
final SyncService sync = sv.mDevice.getSyncService();
if (sync != null) {
SyncProgressHelper.run(new SyncRunnable() {
@Override
public void run(ISyncProgressMonitor monitor) throws SyncException,
IOException, TimeoutException {
if (remote.isDirectory() == false) {
throw new SyncException(SyncError.REMOTE_IS_FILE);
}
// make a list of File from the list of String
ArrayList<java.io.File> files = new ArrayList<java.io.File>();
for (String path : local) {
files.add(new java.io.File(path));
}
// get the total count of the bytes to transfer
java.io.File[] fileArray = files.toArray(new java.io.File[files.size()]);
int total = sync.getTotalLocalFileSize(fileArray);
monitor.start(total);
sync.doPush(fileArray, remote.getPath(), monitor);
monitor.stop();
}
@Override
public void close() {
sync.close();
if (callBack != null) {
callBack.run();
}
}
}, String.format("Push to the device %1$s", getName()), parent);
}
} catch (Exception e) {
e.printStackTrace();
notifyError(e.getMessage());
}
}
开发者ID:lrscp,项目名称:AndroidFileExplorer,代码行数:45,代码来源:File.java
注:本文中的com.android.ddmlib.SyncException.SyncError类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论