Class Indexer
The Indexer operates on input streams that point to class file data. Input streams do not need to be buffered, as the indexer already does this. There is also no limit to the number of class file streams the indexer can process, other than available memory.
The Indexer attempts to minimize the final memory state of the index, but to do this it must maintain additional in-process state (intern tables etc) until the index is complete.
Numerous optimizations are taken during indexing to attempt to minimize the CPU and I/O cost, however, the Java class file format was not designed for partial searching, which ultimately limits the efficiency of processing them.
Thread-Safety This class is not thread-safe can not be shared between threads. The index it produces however is thread-safe.
- Author:
- Jason T. Greene
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncomplete()Completes, finalizes, and returns the index after zero or more calls toindex().voidindex(InputStream stream) Analyze and index the class file data present in given inputstream.index$$bridge(InputStream stream) voidindexClass(Class<?> clazz) Analyze and index the class file data of givenclazz.indexClass$$bridge(Class<?> clazz) indexWithSummary(InputStream stream) Analyze and index the class file data present in given inputstream.
-
Constructor Details
-
Indexer
public Indexer()
-
-
Method Details
-
indexClass
Analyze and index the class file data of givenclazz. Each call adds information to the final complete index.- Parameters:
clazz- a previously-loaded class- Throws:
IOException- if the class file data is corrupt or the underlying stream failsIllegalArgumentException- ifclazzisnull
-
indexClass$$bridge
- Throws:
IOException
-
index
Analyze and index the class file data present in given inputstream. Each call adds information to the final complete index. Closing the input stream is the caller's responsibility.- Parameters:
stream- the class bytecode to index, must not benull- Throws:
IOException- if the class file data is corrupt or the stream failsIllegalArgumentException- ifstreamisnull
-
index$$bridge
- Throws:
IOException
-
indexWithSummary
Analyze and index the class file data present in given inputstream. Each call adds information to the final complete index. Closing the input stream is the caller's responsibility.For reporting progress in batch indexers, this variant of
indexreturns a summary of the just-indexed class.- Parameters:
stream- the class bytecode to index, must not benull- Returns:
- a summary of the just-indexed class
- Throws:
IOException- if the class file data is corrupt or the stream failsIllegalArgumentException- ifstreamisnull
-
complete
Completes, finalizes, and returns the index after zero or more calls toindex(). Future calls toindex()will result in a new index.- Returns:
- the master index for all scanned class streams
-