KickJava   Java API By Example, From Geeks To Geeks.

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


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 import java.io.*;
22
23 import java.util.*;
24
25 import org.apache.poi.hpsf.ClassID;
26
27 /**
28  * This interface defines methods specific to Directory objects
29  * managed by a Filesystem instance.
30  *
31  * @author Marc Johnson (mjohnson at apache dot org)
32  */

33
34 public interface DirectoryEntry
35     extends Entry
36 {
37
38     /**
39      * get an iterator of the Entry instances contained directly in
40      * this instance (in other words, children only; no grandchildren
41      * etc.)
42      *
43      * @return iterator; never null, but hasNext() may return false
44      * immediately (i.e., this DirectoryEntry is empty). All
45      * objects retrieved by next() are guaranteed to be
46      * implementations of Entry.
47      */

48
49     public Iterator getEntries();
50
51     /**
52      * is this DirectoryEntry empty?
53      *
54      * @return true if this instance contains no Entry instances
55      */

56
57     public boolean isEmpty();
58
59     /**
60      * find out how many Entry instances are contained directly within
61      * this DirectoryEntry
62      *
63      * @return number of immediately (no grandchildren etc.) contained
64      * Entry instances
65      */

66
67     public int getEntryCount();
68
69     /**
70      * get a specified Entry by name
71      *
72      * @param name the name of the Entry to obtain.
73      *
74      * @return the specified Entry, if it is directly contained in
75      * this DirectoryEntry
76      *
77      * @exception FileNotFoundException if no Entry with the specified
78      * name exists in this DirectoryEntry
79      */

80
81     public Entry getEntry(final String JavaDoc name)
82         throws FileNotFoundException;
83
84     /**
85      * create a new DocumentEntry
86      *
87      * @param name the name of the new DocumentEntry
88      * @param stream the InputStream from which to create the new
89      * DocumentEntry
90      *
91      * @return the new DocumentEntry
92      *
93      * @exception IOException
94      */

95
96     public DocumentEntry createDocument(final String JavaDoc name,
97                                         final InputStream stream)
98         throws IOException;
99
100     /**
101      * create a new DocumentEntry; the data will be provided later
102      *
103      * @param name the name of the new DocumentEntry
104      * @param size the size of the new DocumentEntry
105      * @param writer the writer of the new DocumentEntry
106      *
107      * @return the new DocumentEntry
108      *
109      * @exception IOException
110      */

111
112     public DocumentEntry createDocument(final String JavaDoc name, final int size,
113                                         final POIFSWriterListener writer)
114         throws IOException;
115
116     /**
117      * create a new DirectoryEntry
118      *
119      * @param name the name of the new DirectoryEntry
120      *
121      * @return the new DirectoryEntry
122      *
123      * @exception IOException
124      */

125
126     public DirectoryEntry createDirectory(final String JavaDoc name)
127         throws IOException;
128
129     /**
130      * Gets the storage clsid of the directory entry
131      *
132      * @return storage Class ID
133      */

134     public ClassID getStorageClsid();
135
136     /**
137      * Sets the storage clsid for the directory entry
138      *
139      * @param clsidStorage storage Class ID
140      */

141     public void setStorageClsid(ClassID clsidStorage);
142
143 } // end public interface DirectoryEntry
144

145
Popular Tags