import java.io.OutputStream;
import java.net.InetAddress;
+import java.util.concurrent.atomic.AtomicLong;
+import java.util.concurrent.atomic.AtomicReference;
import net.pterodactylus.irc.DccReceiver;
private final Pack pack;
/** The name of the file being downloaded. */
- private String filename;
+ private final AtomicReference<String> filename = new AtomicReference<String>();
/** The size of the file being downloaded. */
- private long filesize;
+ private final AtomicLong filesize = new AtomicLong();
/** The remote address. */
- private InetAddress remoteAddress;
+ private final AtomicReference<InetAddress> remoteAddress = new AtomicReference<InetAddress>();
/** The output stream. */
- private OutputStream outputStream;
+ private final AtomicReference<OutputStream> outputStream = new AtomicReference<OutputStream>();
/** The DCC receiver. */
- private DccReceiver dccReceiver;
+ private final AtomicReference<DccReceiver> dccReceiver = new AtomicReference<DccReceiver>();
/**
* Creates a new download.
* @return The full name of the file
*/
public String filename() {
- return filename;
+ return filename.get();
}
/**
* @return The size of the file
*/
public long filesize() {
- return filesize;
+ return filesize.get();
}
/**
* @return The remote address to download from
*/
public InetAddress remoteAddress() {
- return remoteAddress;
+ return remoteAddress.get();
}
/**
* @return The output stream
*/
public OutputStream outputStream() {
- return outputStream;
+ return outputStream.get();
}
/**
* @return The DCC receiver
*/
public DccReceiver dccReceiver() {
- return dccReceiver;
+ return dccReceiver.get();
}
//
* @return This download
*/
public Download filename(String filename) {
- this.filename = filename;
+ this.filename.set(filename);
return this;
}
* @return This download
*/
public Download filesize(long filesize) {
- this.filesize = filesize;
+ this.filesize.set(filesize);
return this;
}
* @return This download
*/
public Download remoteAddress(InetAddress remoteAddress) {
- this.remoteAddress = remoteAddress;
+ this.remoteAddress.set(remoteAddress);
return this;
}
* @return This download
*/
public Download outputStream(OutputStream outputStream) {
- this.outputStream = outputStream;
+ this.outputStream.set(outputStream);
return this;
}
* @return This download
*/
public Download dccReceiver(DccReceiver dccReceiver) {
- this.dccReceiver = dccReceiver;
+ this.dccReceiver.set(dccReceiver);
return this;
}