1 |
|
---|
2 | /* ====================================================================
|
---|
3 | Licensed to the Apache Software Foundation (ASF) under one or more
|
---|
4 | contributor license agreements. See the NOTICE file distributed with
|
---|
5 | this work for additional information regarding copyright ownership.
|
---|
6 | The ASF licenses this file to You under the Apache License, Version 2.0
|
---|
7 | (the "License"); you may not use this file except in compliance with
|
---|
8 | the License. You may obtain a copy of the License at
|
---|
9 |
|
---|
10 | http://www.apache.org/licenses/LICENSE-2.0
|
---|
11 |
|
---|
12 | Unless required by applicable law or agreed to in writing, software
|
---|
13 | distributed under the License is distributed on an "AS IS" BASIS,
|
---|
14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
---|
15 | See the License for the specific language governing permissions and
|
---|
16 | limitations under the License.
|
---|
17 | ==================================================================== */
|
---|
18 |
|
---|
19 |
|
---|
20 | package org.apache.poi.poifs.filesystem;
|
---|
21 |
|
---|
22 | import java.io.FileNotFoundException;
|
---|
23 | import java.io.IOException;
|
---|
24 | import java.io.InputStream;
|
---|
25 | import java.util.Iterator;
|
---|
26 |
|
---|
27 | import org.apache.poi.hpsf.ClassID;
|
---|
28 |
|
---|
29 | /**
|
---|
30 | * This interface defines methods specific to Directory objects
|
---|
31 | * managed by a Filesystem instance.
|
---|
32 | *
|
---|
33 | * @author Marc Johnson (mjohnson at apache dot org)
|
---|
34 | */
|
---|
35 |
|
---|
36 | public interface DirectoryEntry
|
---|
37 | extends Entry, Iterable<Entry>
|
---|
38 | {
|
---|
39 |
|
---|
40 | /**
|
---|
41 | * get an iterator of the Entry instances contained directly in
|
---|
42 | * this instance (in other words, children only; no grandchildren
|
---|
43 | * etc.)
|
---|
44 | *
|
---|
45 | * @return iterator; never null, but hasNext() may return false
|
---|
46 | * immediately (i.e., this DirectoryEntry is empty). All
|
---|
47 | * objects retrieved by next() are guaranteed to be
|
---|
48 | * implementations of Entry.
|
---|
49 | */
|
---|
50 |
|
---|
51 | public Iterator<Entry> getEntries();
|
---|
52 |
|
---|
53 | /**
|
---|
54 | * is this DirectoryEntry empty?
|
---|
55 | *
|
---|
56 | * @return true if this instance contains no Entry instances
|
---|
57 | */
|
---|
58 |
|
---|
59 | public boolean isEmpty();
|
---|
60 |
|
---|
61 | /**
|
---|
62 | * get a specified Entry by name
|
---|
63 | *
|
---|
64 | * @param name the name of the Entry to obtain.
|
---|
65 | *
|
---|
66 | * @return the specified Entry, if it is directly contained in
|
---|
67 | * this DirectoryEntry
|
---|
68 | *
|
---|
69 | * @exception FileNotFoundException if no Entry with the specified
|
---|
70 | * name exists in this DirectoryEntry
|
---|
71 | */
|
---|
72 |
|
---|
73 | public Entry getEntry(final String name)
|
---|
74 | throws FileNotFoundException;
|
---|
75 |
|
---|
76 | /**
|
---|
77 | * create a new DocumentEntry
|
---|
78 | *
|
---|
79 | * @param name the name of the new DocumentEntry
|
---|
80 | * @param stream the InputStream from which to create the new
|
---|
81 | * DocumentEntry
|
---|
82 | *
|
---|
83 | * @return the new DocumentEntry
|
---|
84 | *
|
---|
85 | * @exception IOException
|
---|
86 | */
|
---|
87 |
|
---|
88 | public DocumentEntry createDocument(final String name,
|
---|
89 | final InputStream stream)
|
---|
90 | throws IOException;
|
---|
91 |
|
---|
92 | /**
|
---|
93 | * create a new DirectoryEntry
|
---|
94 | *
|
---|
95 | * @param name the name of the new DirectoryEntry
|
---|
96 | *
|
---|
97 | * @return the new DirectoryEntry
|
---|
98 | *
|
---|
99 | * @exception IOException
|
---|
100 | */
|
---|
101 |
|
---|
102 | public DirectoryEntry createDirectory(final String name)
|
---|
103 | throws IOException;
|
---|
104 |
|
---|
105 | /**
|
---|
106 | * Sets the storage clsid for the directory entry
|
---|
107 | *
|
---|
108 | * @param clsidStorage storage Class ID
|
---|
109 | */
|
---|
110 | public void setStorageClsid(ClassID clsidStorage);
|
---|
111 |
|
---|
112 | } // end public interface DirectoryEntry
|
---|
113 |
|
---|