use of org.opensolaris.opengrok.analysis.FileAnalyzerFactory in project OpenGrok by OpenGrok.
the class JarAnalyzer method analyze.
@Override
public void analyze(Document doc, StreamSource src, Writer xrefOut) throws IOException {
try (ZipInputStream zis = new ZipInputStream(src.getStream())) {
ZipEntry entry;
while ((entry = zis.getNextEntry()) != null) {
String ename = entry.getName();
if (xrefOut != null) {
xrefOut.append("<br/><b>");
Util.htmlize(ename, xrefOut);
xrefOut.append("</b>");
}
doc.add(new TextField("full", ename, Store.NO));
FileAnalyzerFactory fac = AnalyzerGuru.find(ename);
if (fac instanceof JavaClassAnalyzerFactory) {
if (xrefOut != null) {
xrefOut.append("<br/>");
}
JavaClassAnalyzer jca = (JavaClassAnalyzer) fac.getAnalyzer();
jca.analyze(doc, new BufferedInputStream(zis), xrefOut);
}
}
}
}
use of org.opensolaris.opengrok.analysis.FileAnalyzerFactory in project OpenGrok by OpenGrok.
the class IndexerTest method testXref.
@Test
public void testXref() throws IOException {
List<File> files = new ArrayList<>();
FileUtilities.getAllFiles(new File(repository.getSourceRoot()), files, false);
for (File f : files) {
FileAnalyzerFactory factory = AnalyzerGuru.find(f.getAbsolutePath());
if (factory == null) {
continue;
}
StringWriter out;
try (FileReader in = new FileReader(f)) {
out = new StringWriter();
try {
AnalyzerGuru.writeXref(factory, in, out, null, null, null);
} catch (UnsupportedOperationException exp) {
// ignore
}
}
out.close();
}
}
Aggregations