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