/** * Determine whether the directory operation contains an SftpFile * * @param f * @return boolean */ public boolean containsFile(SftpFile f) { return unchangedFiles.contains(f) || newFiles.contains(f) || updatedFiles.contains(f) || deletedFiles.contains(f) || recursedDirectories.contains(f.getAbsolutePath()) || failedTransfers.containsKey(f); }
/** * Get the total number of bytes that this operation will transfer * * @return long */ public long getTransferSize() throws SftpStatusException, SshException { Object obj; long size = 0; SftpFile sftpfile; File file; for (Enumeration e = newFiles.elements(); e.hasMoreElements(); ) { obj = e.nextElement(); if (obj instanceof File) { file = (File) obj; if (file.isFile()) { size += file.length(); } } else if (obj instanceof SftpFile) { sftpfile = (SftpFile) obj; if (sftpfile.isFile()) { size += sftpfile.getAttributes().getSize().longValue(); } } } for (Enumeration e = updatedFiles.elements(); e.hasMoreElements(); ) { obj = e.nextElement(); if (obj instanceof File) { file = (File) obj; if (file.isFile()) { size += file.length(); } } else if (obj instanceof SftpFile) { sftpfile = (SftpFile) obj; if (sftpfile.isFile()) { size += sftpfile.getAttributes().getSize().longValue(); } } } // Add a value for deleted files?? return size; }