Resume a download if a partial file already exists in the temp directory.
[xudocci.git] / src / main / java / net / pterodactylus / xdcc / data / Download.java
index 2d95537..5190ed0 100644 (file)
@@ -18,6 +18,7 @@
 package net.pterodactylus.xdcc.data;
 
 import java.io.OutputStream;
+import java.net.InetAddress;
 
 import net.pterodactylus.irc.DccReceiver;
 
@@ -37,6 +38,12 @@ public class Download {
        /** The name of the file being downloaded. */
        private String filename;
 
+       /** The size of the file being downloaded. */
+       private long filesize;
+
+       /** The remote address. */
+       private InetAddress remoteAddress;
+
        /** The output stream. */
        private OutputStream outputStream;
 
@@ -88,6 +95,24 @@ public class Download {
        }
 
        /**
+        * Returns the size of the file.
+        *
+        * @return The size of the file
+        */
+       public long filesize() {
+               return filesize;
+       }
+
+       /**
+        * Returns the remote address to download from.
+        *
+        * @return The remote address to download from
+        */
+       public InetAddress remoteAddress() {
+               return remoteAddress;
+       }
+
+       /**
         * The output stream that writes to the file.
         *
         * @return The output stream
@@ -122,6 +147,30 @@ public class Download {
        }
 
        /**
+        * Sets the size of the download.
+        *
+        * @param filesize
+        *              The size of the download
+        * @return This download
+        */
+       public Download filesize(long filesize) {
+               this.filesize = filesize;
+               return this;
+       }
+
+       /**
+        * Sets the remote address of the download.
+        *
+        * @param remoteAddress
+        *              The remote address of the download
+        * @return This download
+        */
+       public Download remoteAddress(InetAddress remoteAddress) {
+               this.remoteAddress = remoteAddress;
+               return this;
+       }
+
+       /**
         * Sets the output stream the download is being written to
         *
         * @param outputStream