2 * XdccDownloader - Download.java - Copyright © 2013 David Roden
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 package net.pterodactylus.xdcc.data;
20 import java.io.OutputStream;
22 import net.pterodactylus.irc.DccReceiver;
25 * Information about an ongoing download.
27 * @author <a href="mailto:bombe@pterodactylus.net">David ‘Bombe’ Roden</a>
29 public class Download {
31 /** The bot that is being downloaded from. */
32 private final Bot bot;
34 /** The pack that is being downloaded. */
35 private final Pack pack;
37 /** The name of the file being downloaded. */
38 private String filename;
40 /** The output stream. */
41 private OutputStream outputStream;
43 /** The DCC receiver. */
44 private DccReceiver dccReceiver;
47 * Creates a new download.
50 * The bot offering the download
52 * The pack being downloaded
54 public Download(Bot bot, Pack pack) {
64 * Returns the bot offering the download.
66 * @return The bot offering the download
73 * The pack that is being downloaded.
75 * @return The pack being downloaded
82 * The full name of the file being written.
84 * @return The full name of the file
86 public String filename() {
91 * The output stream that writes to the file.
93 * @return The output stream
95 public OutputStream outputStream() {
100 * The DCC receiver that is downloading the file
102 * @return The DCC receiver
104 public DccReceiver dccReceiver() {
113 * Sets the full name of the file being downloaded.
116 * The full name of the file
117 * @return This download
119 public Download filename(String filename) {
120 this.filename = filename;
125 * Sets the output stream the download is being written to
127 * @param outputStream
129 * @return This download
131 public Download outputStream(OutputStream outputStream) {
132 this.outputStream = outputStream;
137 * Sets the DCC receiver that downloads the file.
141 * @return This download
143 public Download dccReceiver(DccReceiver dccReceiver) {
144 this.dccReceiver = dccReceiver;