From a3d06abf861a58f14bd4c9c06d33d5b101488858 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Sat, 13 Apr 2013 12:30:48 +0200 Subject: [PATCH] Allow the download to start at an arbitrary position. --- .../java/net/pterodactylus/irc/DccReceiver.java | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/main/java/net/pterodactylus/irc/DccReceiver.java b/src/main/java/net/pterodactylus/irc/DccReceiver.java index 9616deb..9ddca13 100644 --- a/src/main/java/net/pterodactylus/irc/DccReceiver.java +++ b/src/main/java/net/pterodactylus/irc/DccReceiver.java @@ -85,10 +85,32 @@ public class DccReceiver extends AbstractExecutionThreadService { * The output stream to write the file to */ public DccReceiver(EventBus eventBus, InetAddress inetAddress, int port, String filename, long size, OutputStream outputStream) { + this(eventBus, inetAddress, port, filename, 0, size, outputStream); + } + + /** + * Creates a new DCC receiver. + * + * @param inetAddress + * The address to connect to + * @param port + * The port number to connect to + * @param filename + * The name of the file being downloaded + * @param startOffset + * The offset at which the download starts in case of a resume + * @param size + * The size of the file being downloaded, or {@code -1} if the size is not + * known + * @param outputStream + * The output stream to write the file to + */ + public DccReceiver(EventBus eventBus, InetAddress inetAddress, int port, String filename, long startOffset, long size, OutputStream outputStream) { this.eventBus = eventBus; this.inetAddress = inetAddress; this.port = port; this.filename = filename; + this.progress = startOffset; this.size = size; this.outputStream = outputStream; } -- 2.7.4