KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > poi > poifs > filesystem > Entry


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

17         
18
19 package org.apache.poi.poifs.filesystem;
20
21 /**
22  * This interface provides access to an object managed by a Filesystem
23  * instance. Entry objects are further divided into DocumentEntry and
24  * DirectoryEntry instances.
25  *
26  * @author Marc Johnson (mjohnson at apache dot org)
27  */

28
29 public interface Entry
30 {
31
32     /**
33      * get the name of the Entry
34      *
35      * @return name
36      */

37
38     public String JavaDoc getName();
39
40     /**
41      * is this a DirectoryEntry?
42      *
43      * @return true if the Entry is a DirectoryEntry, else false
44      */

45
46     public boolean isDirectoryEntry();
47
48     /**
49      * is this a DocumentEntry?
50      *
51      * @return true if the Entry is a DocumentEntry, else false
52      */

53
54     public boolean isDocumentEntry();
55
56     /**
57      * get this Entry's parent (the DirectoryEntry that owns this
58      * Entry). All Entry objects, except the root Entry, has a parent.
59      *
60      * @return this Entry's parent; null iff this is the root Entry
61      */

62
63     public DirectoryEntry getParent();
64
65     /**
66      * Delete this Entry. This operation should succeed, but there are
67      * special circumstances when it will not:
68      *
69      * If this Entry is the root of the Entry tree, it cannot be
70      * deleted, as there is no way to create another one.
71      *
72      * If this Entry is a directory, it cannot be deleted unless it is
73      * empty.
74      *
75      * @return true if the Entry was successfully deleted, else false
76      */

77
78     public boolean delete();
79
80     /**
81      * Rename this Entry. This operation will fail if:
82      *
83      * There is a sibling Entry (i.e., an Entry whose parent is the
84      * same as this Entry's parent) with the same name.
85      *
86      * This Entry is the root of the Entry tree. Its name is dictated
87      * by the Filesystem and many not be changed.
88      *
89      * @param newName the new name for this Entry
90      *
91      * @return true if the operation succeeded, else false
92      */

93
94     public boolean renameTo(final String JavaDoc newName);
95 } // end public interface Entry
96

97
Popular Tags