public class ZipJarCrawler extends Object implements DataProvider
This class browses all entries in a zip/jar archive in filesystem or in classpath.
The organization of entries within the archive is unspecified. All entries are checked in turn. If several entries of the archive are supported by the data loader, all of them will be loaded.
Gzip-compressed files are supported.
Zip archives entries are supported recursively.
This is a simple application of the visitor
design pattern for
zip entries browsing.
DataProvidersManager
GZIP_FILE_PATTERN, ZIP_ARCHIVE_PATTERN
Constructor and Description |
---|
ZipJarCrawler(ClassLoader classLoader,
String resource)
Build a zip crawler for an archive file in classpath.
|
ZipJarCrawler(File file)
Build a zip crawler for an archive file on filesystem.
|
ZipJarCrawler(String resource)
Build a zip crawler for an archive file in classpath.
|
ZipJarCrawler(URL url)
Build a zip crawler for an archive file on network.
|
Modifier and Type | Method and Description |
---|---|
boolean |
feed(Pattern supported,
DataLoader visitor)
Feed a data file loader by browsing the data collection.
|
public ZipJarCrawler(File file)
file
- zip file to browsepublic ZipJarCrawler(String resource) throws OrekitException
Calling this constructor has the same effect as calling
ZipJarCrawler(ClassLoader, String)
with
ZipJarCrawler.class.getClassLoader()
as first
argument.
resource
- name of the zip file to browseOrekitException
- if resource name is malformedpublic ZipJarCrawler(ClassLoader classLoader, String resource) throws OrekitException
classLoader
- class loader to use to retrieve the resourcesresource
- name of the zip file to browseOrekitException
- if resource name is malformedpublic ZipJarCrawler(URL url) throws OrekitException
url
- URL of the zip file on networkOrekitException
- if url syntax is malformedpublic boolean feed(Pattern supported, DataLoader visitor) throws OrekitException
The method crawls all files referenced in the instance (for example all files in a directories tree) and for each file supported by the file loader it asks the file loader to load it.
If the method completes without exception, then the data loader
is considered to have been fed successfully and the top level
data providers manager
will return
immediately without attempting to use the next configured providers.
If the method completes abruptly with an exception, then the top level
data providers manager
will try to use
the next configured providers, in case another one can feed the
data loader
.
feed
in interface DataProvider
supported
- pattern for file names supported by the visitorvisitor
- data file visitor to useOrekitException
- if the data loader cannot be fed
(read error ...)Copyright © 2002-2017 CS Systèmes d'information. All rights reserved.