/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package socius.stream;
import java.rmi.RemoteException;
import java.util.logging.Level;
import java.util.logging.Logger;
import javafx.fxml.Initializable;
import socius.adapter.Arquivo;
import socius.dispositivos.ComputadorRemoto;
import socius.dispositivos.ServidorRemoto;
import socius.telas.principal.PrincipalController;
/**
*
* @author Lucas Dillmann <lucas [at] dillmann.com.br>
*/
public class Download {
private DownloadThread thread;
private long tamanhoTotal;
private String nomeArquivo;
public Download(ServidorRemoto servidor, ComputadorRemoto computador, Arquivo arquivo, PrincipalController controller) {
thread = new DownloadThread(servidor, computador, arquivo, controller);
try {
tamanhoTotal = arquivo.getTamanho();
nomeArquivo = arquivo.getFile().getName();
} catch (RemoteException ex) {
Logger.getLogger(Download.class.getName()).log(Level.SEVERE, null, ex);
}
}
public long getBytesTransferidos() throws InterruptedException {
return thread.bytesTransferidos;
}
public long getBystesTotais() {
return tamanhoTotal;
}
public String getNomeArquivo() {
return nomeArquivo;
}
public void iniciar() {
thread.start();
}
public void interromper() {
thread.stop();
}
}