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>
32 public class PutDirRequestResult extends RequestResult {
34 /** The wrapped PersistentPutDir FCP message. */
35 private final PersistentPutDir persistentPutDir;
38 * Creates a new PutDir request result.
40 * @param persistentPutDir
41 * The PersistentPutDir FCP message to wrap
43 public PutDirRequestResult(PersistentPutDir persistentPutDir) {
44 super(persistentPutDir.getIdentifier());
45 this.persistentPutDir = persistentPutDir;
49 * Returns the number of files in the request.
51 * @return The number of files
52 * @see net.pterodactylus.fcp.PersistentPutDir#getFileCount()
54 public int getFileCount() {
55 return persistentPutDir.getFileCount();
59 * Returns the length of the file at the given index.
62 * The index of the file
63 * @return The length of the file
64 * @see net.pterodactylus.fcp.PersistentPutDir#getFileDataLength(int)
66 public long getFileDataLength(int fileIndex) {
67 return persistentPutDir.getFileDataLength(fileIndex);
71 * Returns the name of the file at the given index.
74 * The index of the file
75 * @return The name of the file
76 * @see net.pterodactylus.fcp.PersistentPutDir#getFileFilename(int)
78 public String getFileFilename(int fileIndex) {
79 return persistentPutDir.getFileFilename(fileIndex);
83 * Returns the content type of the file at the given index.
86 * The index of the file
87 * @return The content type of the file
88 * @see net.pterodactylus.fcp.PersistentPutDir#getFileMetadataContentType(int)
90 public String getFileMetadataContentType(int fileIndex) {
91 return persistentPutDir.getFileMetadataContentType(fileIndex);
95 * Returns the name of the file at the given index.
98 * The index of the file
99 * @return The name of the file
100 * @see net.pterodactylus.fcp.PersistentPutDir#getFileName(int)
102 public String getFileName(int fileIndex) {
103 return persistentPutDir.getFileName(fileIndex);
107 * Returns the upload source of the file at the given index.
110 * The index of the file
111 * @return The upload source of the file
112 * @see net.pterodactylus.fcp.PersistentPutDir#getFileUploadFrom(int)
114 public UploadFrom getFileUploadFrom(int fileIndex) {
115 return persistentPutDir.getFileUploadFrom(fileIndex);
119 * Returns the maximum number of retries for failed blocks.
121 * @return The maximum number of retries
122 * @see net.pterodactylus.fcp.PersistentPutDir#getMaxRetries()
124 public int getMaxRetries() {
125 return persistentPutDir.getMaxRetries();
129 * Returns the priority of the request.
131 * @return The priority
132 * @see net.pterodactylus.fcp.PersistentPutDir#getPriority()
134 public Priority getPriority() {
135 return persistentPutDir.getPriority();
139 * Returns the URI of the request.
141 * @return The URI of the request
142 * @see net.pterodactylus.fcp.PersistentPutDir#getURI()
144 public String getURI() {
145 return persistentPutDir.getURI();
149 * Returns the verbosity of the request.
151 * @return The verbosity
152 * @see net.pterodactylus.fcp.PersistentPutDir#getVerbosity()
154 public Verbosity getVerbosity() {
155 return persistentPutDir.getVerbosity();
159 * Returns whether the request is on the global queue.
161 * @return <code>true</code> if the request is on the global queue,
162 * <code>false</code> if it is on the client-local queue
163 * @see net.pterodactylus.fcp.PersistentPutDir#isGlobal()
165 public boolean isGlobal() {
166 return persistentPutDir.isGlobal();