001: /* ====================================================================
002: Licensed to the Apache Software Foundation (ASF) under one or more
003: contributor license agreements. See the NOTICE file distributed with
004: this work for additional information regarding copyright ownership.
005: The ASF licenses this file to You under the Apache License, Version 2.0
006: (the "License"); you may not use this file except in compliance with
007: the License. You may obtain a copy of the License at
008:
009: http://www.apache.org/licenses/LICENSE-2.0
010:
011: Unless required by applicable law or agreed to in writing, software
012: distributed under the License is distributed on an "AS IS" BASIS,
013: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014: See the License for the specific language governing permissions and
015: limitations under the License.
016: ==================================================================== */
017:
018: package org.apache.poi.poifs.filesystem;
019:
020: import java.io.*;
021:
022: import java.util.*;
023:
024: import org.apache.poi.hpsf.ClassID;
025:
026: /**
027: * This interface defines methods specific to Directory objects
028: * managed by a Filesystem instance.
029: *
030: * @author Marc Johnson (mjohnson at apache dot org)
031: */
032:
033: public interface DirectoryEntry extends Entry {
034:
035: /**
036: * get an iterator of the Entry instances contained directly in
037: * this instance (in other words, children only; no grandchildren
038: * etc.)
039: *
040: * @return iterator; never null, but hasNext() may return false
041: * immediately (i.e., this DirectoryEntry is empty). All
042: * objects retrieved by next() are guaranteed to be
043: * implementations of Entry.
044: */
045:
046: public Iterator getEntries();
047:
048: /**
049: * is this DirectoryEntry empty?
050: *
051: * @return true if this instance contains no Entry instances
052: */
053:
054: public boolean isEmpty();
055:
056: /**
057: * find out how many Entry instances are contained directly within
058: * this DirectoryEntry
059: *
060: * @return number of immediately (no grandchildren etc.) contained
061: * Entry instances
062: */
063:
064: public int getEntryCount();
065:
066: /**
067: * get a specified Entry by name
068: *
069: * @param name the name of the Entry to obtain.
070: *
071: * @return the specified Entry, if it is directly contained in
072: * this DirectoryEntry
073: *
074: * @exception FileNotFoundException if no Entry with the specified
075: * name exists in this DirectoryEntry
076: */
077:
078: public Entry getEntry(final String name)
079: throws FileNotFoundException;
080:
081: /**
082: * create a new DocumentEntry
083: *
084: * @param name the name of the new DocumentEntry
085: * @param stream the InputStream from which to create the new
086: * DocumentEntry
087: *
088: * @return the new DocumentEntry
089: *
090: * @exception IOException
091: */
092:
093: public DocumentEntry createDocument(final String name,
094: final InputStream stream) throws IOException;
095:
096: /**
097: * create a new DocumentEntry; the data will be provided later
098: *
099: * @param name the name of the new DocumentEntry
100: * @param size the size of the new DocumentEntry
101: * @param writer the writer of the new DocumentEntry
102: *
103: * @return the new DocumentEntry
104: *
105: * @exception IOException
106: */
107:
108: public DocumentEntry createDocument(final String name,
109: final int size, final POIFSWriterListener writer)
110: throws IOException;
111:
112: /**
113: * create a new DirectoryEntry
114: *
115: * @param name the name of the new DirectoryEntry
116: *
117: * @return the new DirectoryEntry
118: *
119: * @exception IOException
120: */
121:
122: public DirectoryEntry createDirectory(final String name)
123: throws IOException;
124:
125: /**
126: * Gets the storage clsid of the directory entry
127: *
128: * @return storage Class ID
129: */
130: public ClassID getStorageClsid();
131:
132: /**
133: * Sets the storage clsid for the directory entry
134: *
135: * @param clsidStorage storage Class ID
136: */
137: public void setStorageClsid(ClassID clsidStorage);
138:
139: } // end public interface DirectoryEntry
|