Class FilesScanner

java.lang.Object
org.glassfish.jersey.server.internal.AbstractResourceFinderAdapter
org.glassfish.jersey.server.internal.scanning.FilesScanner
All Implemented Interfaces:
AutoCloseable, Iterator<String>, ResourceFinder

public final class FilesScanner extends AbstractResourceFinderAdapter
A scanner that recursively scans directories and jar files. Files or jar entries are reported to a ResourceProcessor.
  • Field Details

    • files

      private final File[] files
    • recursive

      private final boolean recursive
    • compositeResourceFinder

      private CompositeResourceFinder compositeResourceFinder
  • Constructor Details

    • FilesScanner

      public FilesScanner(String[] fileNames, boolean recursive)
      Scan from a set of packages.
      Parameters:
      fileNames - an array of package names.
      recursive - flag indicating whether sub-directories of any directories in the list of files should be included in the scanning (true) or not (false).
  • Method Details

    • processFile

      private void processFile(File f)
    • hasNext

      public boolean hasNext()
    • next

      public String next()
    • open

      public InputStream open()
      Description copied from interface: ResourceFinder
      Open current resource.
      Returns:
      input stream from which current resource can be loaded.
    • close

      public void close()
      Description copied from class: AbstractResourceFinderAdapter
      Default implementation of #close() which does nothing.
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface ResourceFinder
      Overrides:
      close in class AbstractResourceFinderAdapter
    • reset

      public void reset()
      Description copied from interface: ResourceFinder
      Reset the ResourceFinder instance.

      Upon calling this method the implementing class MUST reset its internal state to the initial state.

    • init

      private void init()