KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > de > schlichtherle > io > archive > spi > ArchiveEntry


1 /*
2  * ArchiveEntry.java
3  *
4  * Created on 26. Februar 2006, 19:08
5  */

6 /*
7  * Copyright 2006 Schlichtherle IT Services
8  *
9  * Licensed under the Apache License, Version 2.0 (the "License");
10  * you may not use this file except in compliance with the License.
11  * You may obtain a copy of the License at
12  *
13  * http://www.apache.org/licenses/LICENSE-2.0
14  *
15  * Unless required by applicable law or agreed to in writing, software
16  * distributed under the License is distributed on an "AS IS" BASIS,
17  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18  * See the License for the specific language governing permissions and
19  * limitations under the License.
20  */

21
22 package de.schlichtherle.io.archive.spi;
23
24 import de.schlichtherle.io.ArchiveEntryMetaData;
25
26 import javax.swing.Icon JavaDoc;
27
28 /**
29  * A simple interface for entries in an archive.
30  * Drivers need to implement this interface in order to allow TrueZIP to
31  * read and write entries for the supported archive types.
32  * <p>
33  * Implementations do <em>not</em> need to be thread safe.
34  *
35  * @author Christian Schlichtherle
36  * @version @version@
37  * @since TrueZIP 6.0
38  */

39 public interface ArchiveEntry {
40     
41     // TODO: Review: Could we refactor File, ArchiveController and
42
// ArchiveFileSystem so that the dependencies on the entry name format
43
// are removed?!
44
/**
45      * Returns the entry name.
46      * An entry name is a path name where the individual components are
47      * separated by a forward slash character (<code>"/"</code>).
48      * A component must not be an empty string (<code>""</code>), a dot
49      * (<code>"."</code>), or a dot-dot (<code>".."</code>).
50      * For example, <code>"foo/bar"</code> would denote a valid path name for
51      * a file entry, but <code>"./abc/../foo/./def/./../bar/."</code> would
52      * not (although the refer to the same entry).
53      * <p>
54      * Furthermore, if the entry is a directory, it's name must end with a
55      * trailing forward slash. For example <code>"dir/"</code> would denote
56      * a valid name for a directory entry, but <code>"dir"</code> would not.
57      *
58      * @return The path name of the entry within the archive
59      * - never <code>null</code>.
60      * @see de.schlichtherle.io.util.Paths#normalize Paths.normalize() for
61      * a utility method to remove empty, dot or dot-dot directories
62      * from a path.
63      */

64     String JavaDoc getName();
65
66     /**
67      * Returns <code>true</code> if and only if this entry represents a
68      * directory.
69      */

70     boolean isDirectory();
71
72     /**
73      * Returns the (uncompressed) size of the archive entry in bytes,
74      * or <code>-1</code> if not specified.
75      * This method is not meaningful for directory entries.
76      */

77     long getSize();
78
79     /**
80      * Returns the last modification time of this archive entry since the
81      * epoch, or <code>-1</code> if not specified.
82      *
83      * @see #setTime(long)
84      */

85     long getTime();
86
87     /**
88      * Sets the last modification time of this archive entry.
89      *
90      * @param time The last modification time of this archive entry in
91      * milliseconds since the epoch.
92      * @see #getTime()
93      */

94     void setTime(long time);
95
96     /**
97      * Returns the icon that {@link de.schlichtherle.io.swing.tree.FileTreeCellRenderer}
98      * should display for this entry if it is open/expanded in the view.
99      * If <code>null</code> is returned, a default icon will be used,
100      * depending on the type of this entry and its state in the view.
101      */

102     Icon JavaDoc getOpenIcon();
103
104     /**
105      * Returns the icon that {@link de.schlichtherle.io.swing.FileSystemView}
106      * and {@link de.schlichtherle.io.swing.tree.FileTreeCellRenderer} should
107      * display for this entry if it is closed/collapsed in the view.
108      * If <code>null</code> is returned, a default icon will be used,
109      * depending on the type of this entry and its state in the view.
110      */

111     Icon JavaDoc getClosedIcon();
112
113     /**
114      * Returns the meta data for this archive entry.
115      * This property is used by TrueZIP's virtual file system class and is
116      * transparent to the driver implementation.
117      */

118     ArchiveEntryMetaData getMetaData();
119
120     /**
121      * Sets the meta data for this archive entry.
122      * This property is used by TrueZIP's virtual file system class and is
123      * transparent to the driver implementation.
124      */

125     void setMetaData(ArchiveEntryMetaData metaData);
126 }
127
Popular Tags