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 charJAR_FILE_SEPARATORprivate java.util.jar.JarInputStreamjarInputStreamprivate static java.util.logging.LoggerLOGGERprivate java.util.jar.JarEntrynextprivate java.lang.Stringparentprivate booleanrecursive
-
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 voidclose()Default implementation of#close()which does nothing.booleanhasNext()java.lang.Stringnext()java.io.InputStreamopen()Open current resource.voidreset()Reset theResourceFinderinstance.-
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.IOExceptionCreate new JAR file scanner.- Parameters:
inputStream- JAR file input streamparent- JAR file entry prefix.recursive- if (truethe packages will be scanned recursively together with any nested packages, iffalseonly the explicitly listed packages will be scanned.- Throws:
java.io.IOException- if wrapping given input stream intoJarInputStreamfailed.
-
-
Method Detail
-
hasNext
public boolean hasNext()
-
next
public java.lang.String next()
-
reset
public void reset()
Description copied from interface:ResourceFinderReset theResourceFinderinstance. 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:ResourceFinderOpen current resource.- Returns:
- input stream from which current resource can be loaded.
-
close
public void close()
Description copied from class:AbstractResourceFinderAdapterDefault implementation of#close()which does nothing.- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfaceResourceFinder- Overrides:
closein classAbstractResourceFinderAdapter
-
-