org.glassfish.jersey.server.internal.scanning
Class JarFileScanner

java.lang.Object
  extended by org.glassfish.jersey.server.internal.scanning.JarFileScanner
All Implemented Interfaces:
Iterator<String>, ResourceFinder

public final class JarFileScanner
extends Object
implements ResourceFinder

A utility class that scans entries in jar files.

Author:
Paul Sandoz

Constructor Summary
JarFileScanner(InputStream inputStream, String parent, boolean recursive)
          Create new JAR file scanner.
 
Method Summary
 boolean hasNext()
           
 String next()
           
 InputStream open()
          Open current resource.
 void remove()
          

This operation is not supported by ResourceFinder & throws UnsupportedOperationException when invoked.

 void reset()
          Reset the ResourceFinder instance.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JarFileScanner

public JarFileScanner(InputStream inputStream,
                      String parent,
                      boolean recursive)
               throws IOException
Create new JAR file scanner.

Parameters:
inputStream - JAR file input stream
parent - JAR file entry prefix.
recursive - if (true the packages will be scanned recursively together with any nested packages, if false only the explicitly listed packages will be scanned.
Throws:
IOException - if wrapping given input stream into JarInputStream failed.
Method Detail

hasNext

public boolean hasNext()
Specified by:
hasNext in interface Iterator<String>

next

public String next()
Specified by:
next in interface Iterator<String>

remove

public void remove()
Description copied from interface: ResourceFinder

This operation is not supported by ResourceFinder & throws UnsupportedOperationException when invoked.

Specified by:
remove in interface Iterator<String>
Specified by:
remove in interface ResourceFinder

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.

Specified by:
reset in interface ResourceFinder

open

public InputStream open()
Description copied from interface: ResourceFinder
Open current resource.

Specified by:
open in interface ResourceFinder
Returns:
input stream from which current resource can be loaded.


Copyright © 2007-2014, Oracle and/or its affiliates. All Rights Reserved. Use is subject to license terms.