javax.naming.internal
Class VersionHelper12.InputStreamEnumeration

java.lang.Object
  |
  +--javax.naming.internal.VersionHelper12.InputStreamEnumeration
All Implemented Interfaces:
Enumeration, NamingEnumeration
Enclosing class:
VersionHelper12

class VersionHelper12.InputStreamEnumeration
extends Object
implements NamingEnumeration

Given an enumeration of URLs, an instance of this class represents an enumeration of their InputStreams. Each operation on the URL enumeration is performed within a doPrivileged block. This is used to enumerate the resources under a foreign codebase.


Constructor Summary
(package private) VersionHelper12.InputStreamEnumeration(Enumeration urls)
           
 
Method Summary
 void close()
          Closes this enumeration.
 boolean hasMore()
          Determines whether there are any more elements in the enumeration.
 boolean hasMoreElements()
           
 Object next()
          Retrieves the next element in the enumeration.
 Object nextElement()
           
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

VersionHelper12.InputStreamEnumeration

VersionHelper12.InputStreamEnumeration(Enumeration urls)
Method Detail

hasMore

public boolean hasMore()
                throws NamingException
Description copied from interface: NamingEnumeration
Determines whether there are any more elements in the enumeration. This method allows naming exceptions encountered while determining whether there are more elements to be caught and handled by the application.
Specified by:
hasMore in interface NamingEnumeration
Following copied from interface: javax.naming.NamingEnumeration
Returns:
true if there is more in the enumeration ; false otherwise.
Throws:
NamingException - If a naming exception is encountered while attempting to determine whether there is another element in the enumeration. See NamingException and its subclasses for the possible naming exceptions.
See Also:
Enumeration.hasMoreElements()

hasMoreElements

public boolean hasMoreElements()
Specified by:
hasMoreElements in interface Enumeration

next

public Object next()
            throws NamingException
Description copied from interface: NamingEnumeration
Retrieves the next element in the enumeration. This method allows naming exceptions encountered while retrieving the next element to be caught and handled by the application.

Note that next() can also throw the runtime exception NoSuchElementException to indicate that the caller is attempting to enumerate beyond the end of the enumeration. This is different from a NamingException, which indicates that there was a problem in obtaining the next element, for example, due to a referral or server unavailability, etc.

Specified by:
next in interface NamingEnumeration
Following copied from interface: javax.naming.NamingEnumeration
Returns:
The possibly null element in the enumeration. null is only valid for enumerations that can return null (e.g. Attribute.getAll() returns an enumeration of attribute values, and an attribute value can be null).
Throws:
NamingException - If a naming exception is encountered while attempting to retrieve the next element. See NamingException and its subclasses for the possible naming exceptions.
NoSuchElementException - If attempting to get the next element when none is available.
See Also:
Enumeration.nextElement()

nextElement

public Object nextElement()
Specified by:
nextElement in interface Enumeration

close

public void close()
Description copied from interface: NamingEnumeration
Closes this enumeration. After this method has been invoked on this enumeration, the enumeration becomes invalid and subsequent invocation of any of its methods will yield undefined results. This method is intended for aborting an enumeration to free up resources. If an enumeration proceeds to the end--that is, until hasMoreElements() or hasMore() returns false-- resources will be freed up automatically and there is no need to explicitly call close().

This method indicates to the service provider that it is free to release resources associated with the enumeration, and can notify servers to cancel any outstanding requests. The close() method is a hint to implementations for managing their resources. Implementations are encouraged to use appropriate algorithms to manage their resources when client omits the close() calls.

Specified by:
close in interface NamingEnumeration
Following copied from interface: javax.naming.NamingEnumeration
Throws:
NamingException - If a naming exception is encountered while closing the enumeration.