private void adbPull(IDevice device, FileEntry remoteDirName, String localDirName) { try { device.getSyncService().pull(new FileEntry[]{remoteDirName}, localDirName, getNullProgressMonitor()); } catch (Exception e) { logDebug(debug, e.getMessage(), e); } }
private void adbPullFile(IDevice device, String remoteFile, String localDir) { try { device.getSyncService() .pullFile(remoteFile, localDir, getNullProgressMonitor()); } catch (Exception e) { logDebug(debug, e.getMessage(), e); } }
@Override public void pushFile(final File localFrom, final String remoteTo) { if (LOGGER.isDebugEnabled()) { LOGGER.debug("pushFile(File, String) - start"); } try { if (device.getSyncService() == null) throw new AndroidScreenCastRuntimeException("SyncService is null, ADB crashed ?"); device.getSyncService().pushFile(localFrom.getAbsolutePath(), remoteTo, SyncService.getNullProgressMonitor()); } catch (final Exception ex) { LOGGER.error("pushFile(File, String)", ex); throw new AndroidScreenCastRuntimeException(ex); } if (LOGGER.isDebugEnabled()) { LOGGER.debug("pushFile(File, String) - end"); } }
private void adbPull(IDevice device, FileEntry remoteDirName, String localDirName) { try { device.getSyncService().pull(new FileEntry[]{remoteDirName}, localDirName, getNullProgressMonitor()); } catch (Exception e) { logDebug(debug, e.getMessage(), e); } }
private void adbPullFile(IDevice device, String remoteFile, String localDir) { try { device.getSyncService() .pullFile(remoteFile, localDir, getNullProgressMonitor()); } catch (Exception e) { logDebug(debug, e.getMessage(), e); } }
@Override public void pullFile(final String removeFrom, final File localTo) { if (LOGGER.isDebugEnabled()) { LOGGER.debug("pullFile(String, File) - start"); } // ugly hack to call the method without FileEntry try { if (device.getSyncService() == null) throw new AndroidScreenCastRuntimeException("SyncService is null, ADB crashed ?"); final Method m = device.getSyncService().getClass().getDeclaredMethod("doPullFile", String.class, String.class, ISyncProgressMonitor.class); m.setAccessible(true); device.getSyncService(); m.invoke(device.getSyncService(), removeFrom, localTo.getAbsolutePath(), SyncService.getNullProgressMonitor()); } catch (final Exception ex) { LOGGER.error("pullFile(String, File)", ex); throw new AndroidScreenCastRuntimeException(ex); } if (LOGGER.isDebugEnabled()) { LOGGER.debug("pullFile(String, File) - end"); } }
public String syncPackageToDevice(String localFilePath) throws IOException, AdbCommandRejectedException, TimeoutException, SyncException { try { String packageFileName = getFileName(localFilePath); String remoteFilePath = String.format("/data/local/tmp/%1$s", packageFileName); //$NON-NLS-1$ Log.d(packageFileName, String.format("Uploading %1$s onto device '%2$s'", packageFileName, getSerialNumber())); SyncService sync = getSyncService(); if (sync != null) { String message = String.format("Uploading file onto device '%1$s'", getSerialNumber()); Log.d(LOG_TAG, message); sync.pushFile(localFilePath, remoteFilePath, SyncService.getNullProgressMonitor()); } else { throw new IOException("Unable to open sync connection!"); } return remoteFilePath; } catch (TimeoutException e) { Log.e(LOG_TAG, "Error during Sync: timeout."); throw e; } catch (SyncException e) { Log.e(LOG_TAG, String.format("Error during Sync: %1$s", e.getMessage())); throw e; } catch (IOException e) { Log.e(LOG_TAG, String.format("Error during Sync: %1$s", e.getMessage())); throw e; } }
getSerialNumber()); Log.d(LOG_TAG, message); sync.pushFile(localFilePath, remoteFilePath, SyncService.getNullProgressMonitor()); } else { throw new IOException("Unable to open sync connection!");
getSerialNumber()); Log.d(LOG_TAG, message); sync.pushFile(local, remote, SyncService.getNullProgressMonitor()); } else { throw new IOException("Unable to open sync connection!");
getSerialNumber()); Log.d(LOG_TAG, message); sync.pushFile(local, remote, SyncService.getNullProgressMonitor()); } else { throw new IOException("Unable to open sync connection!");
getSerialNumber()); Log.d(LOG_TAG, message); sync.pullFile(remote, local, SyncService.getNullProgressMonitor()); } else { throw new IOException("Unable to open sync connection!");
getSerialNumber()); Log.d(LOG_TAG, message); sync.pullFile(remote, local, SyncService.getNullProgressMonitor()); } else { throw new IOException("Unable to open sync connection!");