/** * Fetch the content of each {@link Resource} in this {@link ResourceList} as a byte array, pass the byte array * to the given {@link ByteArrayConsumer}, then close the underlying InputStream or release the underlying * ByteBuffer by calling {@link Resource#close()}. * * @param byteArrayConsumer * The {@link ByteArrayConsumer}. * @throws IllegalArgumentException * if trying to load any of the resources results in an {@link IOException} being thrown. */ public void forEachByteArray(final ByteArrayConsumer byteArrayConsumer) { forEachByteArray(byteArrayConsumer, /* ignoreIOExceptions = */ false); }
/** * Starts up Guice and the scanner */ private void loadScanner() { Stopwatch stopwatch = Stopwatch.createStarted(); GuiceContext.log.info("Loading Classpath Scanner - [" + GuiceContext.getThreadCount() + "] threads"); if (GuiceContext.config == null) { loadConfiguration(); } scanner = new ClassGraph(); configureScanner(scanner); try { scanResult = scanner.scan(GuiceContext.getThreadCount()); Map<String, ResourceList.ByteArrayConsumer> fileScans = quickScanFiles(); fileScans.forEach((key, value) -> scanResult.getResourcesWithLeafName(key) .forEachByteArray(value)); } catch (Exception mpe) { GuiceContext.log.log(Level.SEVERE, "Unable to run scanner", mpe); } stopwatch.stop(); GuiceContext.log.fine("Loaded Classpath Scanner - Took [" + stopwatch.elapsed(TimeUnit.MILLISECONDS) + "] millis."); }
/** * Starts up Guice and the scanner */ private void loadScanner() { Stopwatch stopwatch = Stopwatch.createStarted(); GuiceContext.log.info("Loading Classpath Scanner - [" + GuiceContext.getThreadCount() + "] threads"); if (GuiceContext.config == null) { loadConfiguration(); } scanner = new ClassGraph(); configureScanner(scanner); try { scanResult = scanner.scan(GuiceContext.getThreadCount()); Map<String, ResourceList.ByteArrayConsumer> fileScans = quickScanFiles(); fileScans.forEach((key, value) -> scanResult.getResourcesWithLeafName(key) .forEachByteArray(value)); } catch (Exception mpe) { GuiceContext.log.log(Level.SEVERE, "Unable to run scanner", mpe); } stopwatch.stop(); GuiceContext.log.fine("Loaded Classpath Scanner - Took [" + stopwatch.elapsed(TimeUnit.MILLISECONDS) + "] millis."); }
fileScans.forEach((key, value) -> scanResult.getResourcesWithLeafName(key) .forEachByteArray(value));