Class ZipDirectory
java.lang.Object
org.apache.aries.util.filesystem.impl.ZipFileImpl
org.apache.aries.util.filesystem.impl.ZipDirectory
- All Implemented Interfaces:
Iterable<IFile>,IDirectory,IFile
A directory in the zip.
-
Constructor Summary
ConstructorsConstructorDescriptionZipDirectory(File zip1, ZipEntry entry1, ZipDirectory parent, ZipCloseableDirectory cache) Constructs a directory in the zip.ZipDirectory(File fs, IDirectory parent) This constructor creates the root of the zip.ZipDirectory(ZipDirectory other, ZipCloseableDirectory cache) -
Method Summary
Modifier and TypeMethodDescriptionconvert()booleanGets the requested file under this directory.getRoot()inthashCode()booleanbooleanisFile()booleanisRoot()booleaniterator()open()The input stream returned by this method should always be closed after use.Open a more effective implementation with user regulated resource management.Methods inherited from class org.apache.aries.util.filesystem.impl.ZipFileImpl
convertNested, getLastModified, getName, getNameInZip, getParent, getSize, getZipPathToRoot, toString, toURLMethods inherited from interface org.apache.aries.util.filesystem.IFile
convertNested, getLastModified, getName, getParent, getSize, toURLMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Constructor Details
-
ZipDirectory
Constructs a directory in the zip.- Parameters:
zip1- the zip file.entry1- the entry in the zip representing this dir.parent- the parent directory.
-
ZipDirectory
This constructor creates the root of the zip.- Parameters:
fs-parent-file-- Throws:
MalformedURLException
-
ZipDirectory
-
-
Method Details
-
getFile
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.
-
isRoot
public boolean isRoot()- Specified by:
isRootin interfaceIDirectory- Returns:
- true if this IDirectory is the root of the virtual file system.
-
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
- Specified by:
listAllFilesin interfaceIDirectory- Returns:
- the list of files in all directories (including sub-directories). This is the complete list.
-
iterator
-
convert
- Specified by:
convertin interfaceIFile- Overrides:
convertin classZipFileImpl- Returns:
- if this is a directory return this as an IDirectory, otherwise return null.
-
isDirectory
public boolean isDirectory()- Specified by:
isDirectoryin interfaceIFile- Overrides:
isDirectoryin classZipFileImpl- Returns:
- true iff this IFile is also an IDirectory
-
isFile
public boolean isFile()- Specified by:
isFilein interfaceIFile- Overrides:
isFilein classZipFileImpl- Returns:
- true iff this IFile is not an IDirectory
-
open
Description copied from interface:IFileThe input stream returned by this method should always be closed after use.- Specified by:
openin interfaceIFile- Overrides:
openin classZipFileImpl- Returns:
- An InputStream to read the file from.
-
getRoot
- Specified by:
getRootin interfaceIFile- Overrides:
getRootin classZipFileImpl- Returns:
- the root of this file system.
-
isZipRoot
public boolean isZipRoot() -
equals
- Overrides:
equalsin classZipFileImpl
-
hashCode
public int hashCode()- Overrides:
hashCodein classZipFileImpl
-
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
-