What do you mean by 'calculate directory'?
public class CustomFTPMonitor implements FTPProgressMonitor {
private long filesize = 0;
private double percentage = 0;
public CustomFTPMonitor(long size) {
filesize = size;
}
@Override
public void bytesTransferred(long bytes) {
if ((int)percentage == 100) {
percentage = 0;
}
percentage = ((double) bytes / (double) filesize) * 100;
Ftp.bar.setValue((int)percentage);
}
}
long size = getSize(new File("C:\A"));
UpDirMonitor monitor = new UpDirMonitor(size);
ftpClient.setProgressMonitor(monitor, 1024);
here is my code,"C:\A" is a directory, which some files in, bytes in "bytesTransferred(long bytes)" calculate the separate files.