Class JarFileScanner
- java.lang.Object
-
- org.glassfish.jersey.server.internal.AbstractResourceFinderAdapter
-
- org.glassfish.jersey.server.internal.scanning.JarFileScanner
-
- All Implemented Interfaces:
java.lang.AutoCloseable
,java.util.Iterator<java.lang.String>
,ResourceFinder
public final class JarFileScanner extends AbstractResourceFinderAdapter
A utility class that scans entries in jar files.
-
-
Field Summary
Fields Modifier and Type Field Description private static char
JAR_FILE_SEPARATOR
private java.util.jar.JarInputStream
jarInputStream
private static java.util.logging.Logger
LOGGER
private java.util.jar.JarEntry
next
private java.lang.String
parent
private boolean
recursive
-
Constructor Summary
Constructors Constructor Description JarFileScanner(java.io.InputStream inputStream, java.lang.String parent, boolean recursive)
Create new JAR file scanner.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
Default implementation of#close()
which does nothing.boolean
hasNext()
java.lang.String
next()
java.io.InputStream
open()
Open current resource.void
reset()
Reset theResourceFinder
instance.-
Methods inherited from class org.glassfish.jersey.server.internal.AbstractResourceFinderAdapter
remove
-
-
-
-
Field Detail
-
LOGGER
private static final java.util.logging.Logger LOGGER
-
JAR_FILE_SEPARATOR
private static final char JAR_FILE_SEPARATOR
- See Also:
- Constant Field Values
-
jarInputStream
private final java.util.jar.JarInputStream jarInputStream
-
parent
private final java.lang.String parent
-
recursive
private final boolean recursive
-
next
private java.util.jar.JarEntry next
-
-
Constructor Detail
-
JarFileScanner
public JarFileScanner(java.io.InputStream inputStream, java.lang.String parent, boolean recursive) throws java.io.IOException
Create new JAR file scanner.- Parameters:
inputStream
- JAR file input streamparent
- JAR file entry prefix.recursive
- if (true
the packages will be scanned recursively together with any nested packages, iffalse
only the explicitly listed packages will be scanned.- Throws:
java.io.IOException
- if wrapping given input stream intoJarInputStream
failed.
-
-
Method Detail
-
hasNext
public boolean hasNext()
-
next
public java.lang.String next()
-
reset
public void reset()
Description copied from interface:ResourceFinder
Reset theResourceFinder
instance. Upon calling this method the implementing class MUST reset its internal state to the initial state.
-
open
public java.io.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 interfacejava.lang.AutoCloseable
- Specified by:
close
in interfaceResourceFinder
- Overrides:
close
in classAbstractResourceFinderAdapter
-
-