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); } }
SyncService syncService = device.getSyncService();
try SyncService syncService = device.getSyncService(); FileListingService fileListingService = device.getFileListingService();
/** * Returns a {@link SyncService} object to push / pull files to and from the device. * * @return <code>null</code> if the SyncService couldn't be created. This can happen if adb * refuse to open the connection because the {@link IDevice} is invalid * (or got disconnected). * @throws TimeoutException in case of timeout on the connection. * @throws AdbCommandRejectedException if adb rejects the command * @throws IOException if the connection with adb failed. */ @Override public SyncService getSyncService() throws TimeoutException, AdbCommandRejectedException, IOException { return device.getSyncService(); }
@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"); } }
@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); } }