🎨 Fix whitespace at EOF
[jSite.git] / src / main / java / de / todesbaum / util / freenet / fcp2 / FileEntry.java
1 /*
2  * jSite - FileEntry.java - Copyright Â© 2006–2019 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 2 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, write to the Free Software
16  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17  */
18
19 package de.todesbaum.util.freenet.fcp2;
20
21 /**
22  * Abstract base class of file entries that are used in the
23  * {@link de.todesbaum.util.freenet.fcp2.ClientPutComplexDir} command to define
24  * the files of an insert.
25  *
26  * @author David Roden <droden@gmail.com>
27  * @version $Id$
28  */
29 public abstract class FileEntry {
30
31         /** The name of the file. */
32         private final String filename;
33
34         /** The content type of the file. */
35         private final String contentType;
36
37         /**
38          * Creates a new file entry with the specified name and content type. The
39          * content type should be a standard MIME type with an additional charset
40          * specification for text-based types.
41          *
42          * @param filename
43          *            The name of the file
44          * @param contentType
45          *            The content type of the file, e.g.
46          *            <code>"application/x-tar"</code> or
47          *            <code>"text/html; charset=iso8859-15"</code>
48          */
49         protected FileEntry(String filename, String contentType) {
50                 this.filename = filename;
51                 this.contentType = contentType;
52         }
53
54         /**
55          * Returns the name of this entry's type. Can be one of <code>direct</code>,
56          * <code>disk</code>, or <code>redirect</code>. This method is
57          * implemented by the subclasses {@link DirectFileEntry},
58          * {@link DiskFileEntry}, and {@link RedirectFileEntry}, respectively.
59          *
60          * @return The name of this entry's type
61          */
62         public abstract String getName();
63
64         /**
65          * Returns the content type of this file.
66          *
67          * @return The content type of this file
68          */
69         public String getContentType() {
70                 return contentType;
71         }
72
73         /**
74          * Returns the name of this file.
75          *
76          * @return The name of this file
77          */
78         public String getFilename() {
79                 return filename;
80         }
81
82 }