Update license to GPLv3, fix header comments
[jFCPlib.git] / src / main / java / net / pterodactylus / fcp / TestDDAReply.java
1 /*
2  * jFCPlib - TestDDAReply.java - Copyright © 2008–2016 David Roden
3  *
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.
8  *
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.
13  *
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/>.
16  */
17
18 package net.pterodactylus.fcp;
19
20 /**
21  * The “TestDDAReply” is sent as a response to {@link TestDDARequest}. If you
22  * specified that you wanted to read files from that directory
23  * {@link #getReadFilename()} will give you a filename. Similarly, if you
24  * specified that you want to write in the directory
25  * {@link #getWriteFilename()} will give you a filename to write
26  * {@link #getContentToWrite()} to.
27  *
28  * @author David ‘Bombe’ Roden &lt;bombe@freenetproject.org&gt;
29  */
30 public class TestDDAReply extends BaseMessage {
31
32         /**
33          * Creates a “TestDDAReply” message that wraps the received message.
34          *
35          * @param receivedMessage
36          *            The received message
37          */
38         public TestDDAReply(FcpMessage receivedMessage) {
39                 super(receivedMessage);
40         }
41
42         /**
43          * Returns the directory the TestDDRequest was made for.
44          *
45          * @return The directory to test
46          */
47         public String getDirectory() {
48                 return getField("Directory");
49         }
50
51         /**
52          * Returns the filename you have to read to proof your ability to read that
53          * specific directory.
54          *
55          * @return The name of the file to read
56          */
57         public String getReadFilename() {
58                 return getField("ReadFilename");
59         }
60
61         /**
62          * Returns the filename you have to write to to proof your ability to write
63          * to that specific directory.
64          *
65          * @return The name of the file write to
66          */
67         public String getWriteFilename() {
68                 return getField("WriteFilename");
69         }
70
71         /**
72          * If you requested a test for writing permissions you have to write the
73          * return value of this method to the file given by
74          * {@link #getWriteFilename()}.
75          *
76          * @return The content to write to the file
77          */
78         public String getContentToWrite() {
79                 return getField("ContentToWrite");
80         }
81
82 }