if ( sourceFileEntry.isDirectory() )
/** * 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(); }
/** * 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(); }
private void doLsAndThrow(FileEntry entry) throws TimeoutException, AdbCommandRejectedException, ShellCommandUnresponsiveException, IOException { // create a list that will receive the list of the entries ArrayList<FileEntry> entryList = new ArrayList<FileEntry>(); // create a list that will receive the link to compute post ls; ArrayList<String> linkList = new ArrayList<String>(); try { // create the command String command = "ls -l " + entry.getFullEscapedPath(); //$NON-NLS-1$ if (entry.isDirectory()) { // If we expect a file to behave like a directory, we should stick a "/" at the end. // This is a good habit, and is mandatory for symlinks-to-directories, which will // otherwise behave like symlinks. command += FILE_SEPARATOR; } // create the receiver object that will parse the result from ls LsReceiver receiver = new LsReceiver(entry, entryList, linkList); // call ls. mDevice.executeShellCommand(command, receiver); // finish the process of the receiver to handle links receiver.finishLinks(mDevice, entryList); } finally { // at this point we need to refresh the viewer entry.fetchTime = System.currentTimeMillis(); // sort the children and set them as the new children Collections.sort(entryList, FileEntry.sEntryComparator); entry.setChildren(entryList); } }