Class NestedZipDirectory
java.lang.Object
org.apache.aries.util.filesystem.impl.NestedZipFile
org.apache.aries.util.filesystem.impl.NestedZipDirectory
- All Implemented Interfaces:
Iterable<IFile>
,IDirectory
,IFile
-
Constructor Summary
ConstructorsConstructorDescriptionNestedZipDirectory
(IFile archive) NestedZipDirectory
(IFile archive, String pathInZip, NestedZipDirectory parent, NestedCloseableDirectory cache) NestedZipDirectory
(IFile archive, ZipEntry entry, NestedZipDirectory parent, NestedCloseableDirectory cache) NestedZipDirectory
(NestedZipDirectory other, NestedCloseableDirectory cache) -
Method Summary
Modifier and TypeMethodDescriptionconvert()
Gets the requested file under this directory.boolean
boolean
isFile()
boolean
isRoot()
iterator()
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.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
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Constructor Details
-
NestedZipDirectory
public NestedZipDirectory(IFile archive, ZipEntry entry, NestedZipDirectory parent, NestedCloseableDirectory cache) -
NestedZipDirectory
public NestedZipDirectory(IFile archive, String pathInZip, NestedZipDirectory parent, NestedCloseableDirectory cache) -
NestedZipDirectory
-
NestedZipDirectory
-
-
Method Details
-
convert
- Specified by:
convert
in interfaceIFile
- Overrides:
convert
in classNestedZipFile
- Returns:
- if this is a directory return this as an IDirectory, otherwise return null.
-
iterator
-
listFiles
- Specified by:
listFiles
in interfaceIDirectory
- Returns:
- the list of files in this directory. Files must be in this directory and not in sub-directories.
-
listAllFiles
- Specified by:
listAllFiles
in interfaceIDirectory
- Returns:
- the list of files in all directories (including sub-directories). This is the complete list.
-
getFile
Description copied from interface:IDirectory
Gets 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:
getFile
in interfaceIDirectory
- Parameters:
name
- the name of the file.- Returns:
- the IFile, or null if no such file exists.
-
isDirectory
public boolean isDirectory()- Specified by:
isDirectory
in interfaceIFile
- Overrides:
isDirectory
in classNestedZipFile
- Returns:
- true iff this IFile is also an IDirectory
-
open
Description copied from interface:IFile
The input stream returned by this method should always be closed after use.- Specified by:
open
in interfaceIFile
- Overrides:
open
in classNestedZipFile
- Returns:
- An InputStream to read the file from.
- Throws:
IOException
UnsupportedOperationException
- If the IFile is also an IDirectory.
-
isFile
public boolean isFile()- Specified by:
isFile
in interfaceIFile
- Overrides:
isFile
in classNestedZipFile
- Returns:
- true iff this IFile is not an IDirectory
-
isRoot
public boolean isRoot()- Specified by:
isRoot
in interfaceIDirectory
- Returns:
- true if this IDirectory is the root of the virtual file system.
-
toCloseable
Description copied from interface:IDirectory
Open 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:
toCloseable
in interfaceIDirectory
- Returns:
ICloseableDirectory
or null if a batch aware version of thisIDirectory
is not supported
-