All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.seanshubin.detangler.scanner.ScannerImpl.scala Maven / Gradle / Ivy

There is a newer version: 0.9.4
Show newest version
package com.seanshubin.detangler.scanner

import java.nio.file.Path

import com.seanshubin.detangler.timer.Timer

class ScannerImpl(directoryScanner: DirectoryScanner,
                  fileScanner: FileScanner,
                  classBytesScanner: ClassBytesScanner,
                  timer: Timer) extends Scanner {
  override def scanDependencies(): Iterable[(String, Seq[String])] = {
    val files: Iterable[Path] = directoryScanner.findFiles()
    def scanFile(file: Path): Iterable[Seq[Byte]] = fileScanner.loadBytes(file)
    val classBytesSeq = timer.measureTime("load bytes")(files.flatMap(scanFile))
    val dependencies = timer.measureTime("parse classes")(classBytesSeq.map(classBytesScanner.parseDependencies))
    dependencies
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy