Class NestedZipDirectory
- java.lang.Object
-
- org.apache.aries.util.filesystem.impl.NestedZipFile
-
- org.apache.aries.util.filesystem.impl.NestedZipDirectory
-
- All Implemented Interfaces:
java.lang.Iterable<IFile>,IDirectory,IFile
public class NestedZipDirectory extends NestedZipFile implements IDirectory
-
-
Constructor Summary
Constructors Constructor Description NestedZipDirectory(IFile archive)NestedZipDirectory(IFile archive, java.lang.String pathInZip, NestedZipDirectory parent, NestedCloseableDirectory cache)NestedZipDirectory(IFile archive, java.util.zip.ZipEntry entry, NestedZipDirectory parent, NestedCloseableDirectory cache)NestedZipDirectory(NestedZipDirectory other, NestedCloseableDirectory cache)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description IDirectoryconvert()IFilegetFile(java.lang.String name)Gets the requested file under this directory.booleanisDirectory()booleanisFile()booleanisRoot()java.util.Iterator<IFile>iterator()java.util.List<IFile>listAllFiles()java.util.List<IFile>listFiles()java.io.InputStreamopen()The input stream returned by this method should always be closed after use.ICloseableDirectorytoCloseable()Open a more effective implementation with user regulated resource management.-
Methods inherited from class org.apache.aries.util.filesystem.impl.NestedZipFile
convertNested, equals, getLastModified, getName, getNameInZip, getParent, getRoot, getSize, hashCode, toString, toURL
-
Methods inherited from interface org.apache.aries.util.filesystem.IFile
convertNested, getLastModified, getName, getParent, getRoot, getSize, toURL
-
-
-
-
Constructor Detail
-
NestedZipDirectory
public NestedZipDirectory(IFile archive, java.util.zip.ZipEntry entry, NestedZipDirectory parent, NestedCloseableDirectory cache)
-
NestedZipDirectory
public NestedZipDirectory(IFile archive, java.lang.String pathInZip, NestedZipDirectory parent, NestedCloseableDirectory cache)
-
NestedZipDirectory
public NestedZipDirectory(IFile archive)
-
NestedZipDirectory
public NestedZipDirectory(NestedZipDirectory other, NestedCloseableDirectory cache)
-
-
Method Detail
-
convert
public IDirectory convert()
- Specified by:
convertin interfaceIFile- Overrides:
convertin classNestedZipFile- Returns:
- if this is a directory return this as an IDirectory, otherwise return null.
-
iterator
public java.util.Iterator<IFile> iterator()
- Specified by:
iteratorin interfacejava.lang.Iterable<IFile>
-
listFiles
public java.util.List<IFile> listFiles()
- Specified by:
listFilesin interfaceIDirectory- Returns:
- the list of files in this directory. Files must be in this directory and not in sub-directories.
-
listAllFiles
public java.util.List<IFile> listAllFiles()
- Specified by:
listAllFilesin interfaceIDirectory- Returns:
- the list of files in all directories (including sub-directories). This is the complete list.
-
getFile
public IFile getFile(java.lang.String name)
Description copied from interface:IDirectoryGets the requested file under this directory. The file may be located any number of levels within this directory. The name is relative to this directory. If the file cannot be found it will return null.- Specified by:
getFilein interfaceIDirectory- Parameters:
name- the name of the file.- Returns:
- the IFile, or null if no such file exists.
-
isDirectory
public boolean isDirectory()
- Specified by:
isDirectoryin interfaceIFile- Overrides:
isDirectoryin classNestedZipFile- Returns:
- true iff this IFile is also an IDirectory
-
open
public java.io.InputStream open() throws java.io.IOException, java.lang.UnsupportedOperationExceptionDescription copied from interface:IFileThe input stream returned by this method should always be closed after use.- Specified by:
openin interfaceIFile- Overrides:
openin classNestedZipFile- Returns:
- An InputStream to read the file from.
- Throws:
java.io.IOExceptionjava.lang.UnsupportedOperationException- If the IFile is also an IDirectory.
-
isFile
public boolean isFile()
- Specified by:
isFilein interfaceIFile- Overrides:
isFilein classNestedZipFile- Returns:
- true iff this IFile is not an IDirectory
-
isRoot
public boolean isRoot()
- Specified by:
isRootin interfaceIDirectory- Returns:
- true if this IDirectory is the root of the virtual file system.
-
toCloseable
public ICloseableDirectory toCloseable()
Description copied from interface:IDirectoryOpen a more effective implementation with user regulated resource management. The implementation will be more efficient for batch operations. Make sure to call close when finished with the returned IDirectory. IFiles and IDirectories other than the returned closeable directory will stay valid after calling the close method but will no longer perform as efficiently. InputStreams that are open at the time of calling close may be invalidated.- Specified by:
toCloseablein interfaceIDirectory- Returns:
ICloseableDirectoryor null if a batch aware version of thisIDirectoryis not supported
-
-