Package com.luciad.util.enumeration
Class TLcdFinalizedEnumeration
java.lang.Object
com.luciad.util.enumeration.TLcdFinalizedEnumeration
- All Implemented Interfaces:
ILcdAutoCloseableEnumeration
,AutoCloseable
,Enumeration
This class returns a given
Enumeration
, and performs a given action after
having returned the last element.
Example application: when an Enumeration
returns data from a file, the
finalizing action can close the file at the end. This way the consumer
of the data does not have to be aware of the data source.
-
Constructor Summary
ConstructorDescriptionTLcdFinalizedEnumeration
(Enumeration aEnumeration, ILcdFinalizeAction aFinalizeAction) Constructs a newEnumeration
that is identical to the givenEnumeration
, but in addition it performs the given action after having returned the last element. -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
This close method does not throw checked exceptions.boolean
ImplementsEnumeration.hasMoreElements()
.ImplementsEnumeration.nextElement()
.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.util.Enumeration
asIterator
-
Constructor Details
-
TLcdFinalizedEnumeration
Constructs a newEnumeration
that is identical to the givenEnumeration
, but in addition it performs the given action after having returned the last element.- Parameters:
aEnumeration
- theEnumeration
that will be returned.aFinalizeAction
- the action that is performed at the end.
-
-
Method Details
-
hasMoreElements
public boolean hasMoreElements()ImplementsEnumeration.hasMoreElements()
.- Specified by:
hasMoreElements
in interfaceEnumeration
-
nextElement
ImplementsEnumeration.nextElement()
.- Specified by:
nextElement
in interfaceEnumeration
-
close
public void close()Description copied from interface:ILcdAutoCloseableEnumeration
This close method does not throw checked exceptions.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceILcdAutoCloseableEnumeration
-