public class SimpleIndexer
extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
static interface |
SimpleIndexer.FileAnalyzer
A functional interface providing an entry point for performing additional
analysis of indexed files.
|
| Modifier and Type | Field and Description |
|---|---|
private SimpleIndexer.FileAnalyzer |
analyzer |
private java.nio.file.Path |
base |
private boolean |
compress |
private java.util.Set<java.io.File> |
files |
private long |
increment |
private java.lang.String |
name |
private Reporter |
reporter |
| Constructor and Description |
|---|
SimpleIndexer() |
| Modifier and Type | Method and Description |
|---|---|
SimpleIndexer |
analyzer(SimpleIndexer.FileAnalyzer analyzer) |
SimpleIndexer |
base(java.net.URI base) |
SimpleIndexer |
compress(boolean compress) |
SimpleIndexer |
files(java.util.Collection<java.io.File> files)
Adds files to be indexed.
|
java.util.List<org.osgi.resource.Resource> |
getResources()
Return the resources so far.
|
SimpleIndexer |
increment(long increment) |
void |
index(java.io.File file)
Generate the index to the specified file.
|
void |
index(java.io.OutputStream outputStream)
Generate the index to the specified output stream.
|
private org.osgi.resource.Resource |
indexFile(java.io.File file) |
SimpleIndexer |
name(java.lang.String name) |
private java.net.URI |
relativize(java.io.File file) |
SimpleIndexer |
reporter(Reporter reporter) |
private XMLResourceGenerator |
repository() |
private final java.util.Set<java.io.File> files
private java.nio.file.Path base
private boolean compress
private java.lang.String name
private long increment
private SimpleIndexer.FileAnalyzer analyzer
private Reporter reporter
public SimpleIndexer files(java.util.Collection<java.io.File> files)
files - the files to include in the indexpublic SimpleIndexer base(java.net.URI base)
base - the base URI from which the index urls are relativepublic SimpleIndexer compress(boolean compress)
compress - compress with GZIP when truepublic SimpleIndexer name(java.lang.String name)
name - an optional name for the indexpublic SimpleIndexer analyzer(SimpleIndexer.FileAnalyzer analyzer)
analyzer - a resource analyzerpublic SimpleIndexer increment(long increment)
increment - the timestamp of the indexpublic void index(java.io.OutputStream outputStream)
throws java.io.IOException
outputStream - the output stream to write the index filejava.io.IOException - if a file cannot be indexedpublic void index(java.io.File file)
throws java.io.IOException
file - the file to write the index filejava.io.IOException - if a file cannot be indexedpublic java.util.List<org.osgi.resource.Resource> getResources()
public SimpleIndexer reporter(Reporter reporter)
private XMLResourceGenerator repository()
private org.osgi.resource.Resource indexFile(java.io.File file)
private java.net.URI relativize(java.io.File file)