2 * jFCPlib-high-level-client - PutDirRequestResult.java -
3 * Copyright © 2008 David Roden
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20 package net.pterodactylus.fcp.highlevel;
22 import net.pterodactylus.fcp.PersistentPutDir;
23 import net.pterodactylus.fcp.Priority;
24 import net.pterodactylus.fcp.UploadFrom;
25 import net.pterodactylus.fcp.Verbosity;
28 * A PutDir request result is generated by {@link HighLevelClient#getRequests()}.
30 * @author David ‘Bombe’ Roden <bombe@freenetproject.org>
33 public class PutDirRequestResult extends RequestResult {
35 /** The wrapped PersistentPutDir FCP message. */
36 private final PersistentPutDir persistentPutDir;
39 * Creates a new PutDir request result.
41 * @param persistentPutDir
42 * The PersistentPutDir FCP message to wrap
44 public PutDirRequestResult(PersistentPutDir persistentPutDir) {
45 super(persistentPutDir.getIdentifier());
46 this.persistentPutDir = persistentPutDir;
50 * Returns the number of files in the request.
52 * @return The number of files
53 * @see net.pterodactylus.fcp.PersistentPutDir#getFileCount()
55 public int getFileCount() {
56 return persistentPutDir.getFileCount();
60 * Returns the length of the file at the given index.
63 * The index of the file
64 * @return The length of the file
65 * @see net.pterodactylus.fcp.PersistentPutDir#getFileDataLength(int)
67 public long getFileDataLength(int fileIndex) {
68 return persistentPutDir.getFileDataLength(fileIndex);
72 * Returns the name of the file at the given index.
75 * The index of the file
76 * @return The name of the file
77 * @see net.pterodactylus.fcp.PersistentPutDir#getFileFilename(int)
79 public String getFileFilename(int fileIndex) {
80 return persistentPutDir.getFileFilename(fileIndex);
84 * Returns the content type of the file at the given index.
87 * The index of the file
88 * @return The content type of the file
89 * @see net.pterodactylus.fcp.PersistentPutDir#getFileMetadataContentType(int)
91 public String getFileMetadataContentType(int fileIndex) {
92 return persistentPutDir.getFileMetadataContentType(fileIndex);
96 * Returns the name of the file at the given index.
99 * The index of the file
100 * @return The name of the file
101 * @see net.pterodactylus.fcp.PersistentPutDir#getFileName(int)
103 public String getFileName(int fileIndex) {
104 return persistentPutDir.getFileName(fileIndex);
108 * Returns the upload source of the file at the given index.
111 * The index of the file
112 * @return The upload source of the file
113 * @see net.pterodactylus.fcp.PersistentPutDir#getFileUploadFrom(int)
115 public UploadFrom getFileUploadFrom(int fileIndex) {
116 return persistentPutDir.getFileUploadFrom(fileIndex);
120 * Returns the maximum number of retries for failed blocks.
122 * @return The maximum number of retries
123 * @see net.pterodactylus.fcp.PersistentPutDir#getMaxRetries()
125 public int getMaxRetries() {
126 return persistentPutDir.getMaxRetries();
130 * Returns the priority of the request.
132 * @return The priority
133 * @see net.pterodactylus.fcp.PersistentPutDir#getPriority()
135 public Priority getPriority() {
136 return persistentPutDir.getPriority();
140 * Returns the URI of the request.
142 * @return The URI of the request
143 * @see net.pterodactylus.fcp.PersistentPutDir#getURI()
145 public String getURI() {
146 return persistentPutDir.getURI();
150 * Returns the verbosity of the request.
152 * @return The verbosity
153 * @see net.pterodactylus.fcp.PersistentPutDir#getVerbosity()
155 public Verbosity getVerbosity() {
156 return persistentPutDir.getVerbosity();
160 * Returns whether the request is on the global queue.
162 * @return <code>true</code> if the request is on the global queue,
163 * <code>false</code> if it is on the client-local queue
164 * @see net.pterodactylus.fcp.PersistentPutDir#isGlobal()
166 public boolean isGlobal() {
167 return persistentPutDir.isGlobal();