synchronized(job) {
if(job.getState() != State.NEW) return;
job.setState(State.WORKING);
}
try {
Source src = job.getSource();
Destination dst = job.getDestination();
BoundedRangeModel progress = job.getProgress();
if(dst.exists()) {
progress.setMaximum(1);
progress.setValue(1);
} else {
progress.setMaximum(src.length());
InputStream is = new BufferedInputStream(src.open());
try {
OutputStream os = new BufferedOutputStream(dst.open());
try {
byte[] buf = new byte[8 * 1024];
int total = 0;