Project JXTA

net.jxta.impl.util
Class DynamicEnumeration

java.lang.Object
  extended bynet.jxta.impl.util.DynamicEnumeration
All Implemented Interfaces:
Enumeration

public class DynamicEnumeration
extends Object
implements Enumeration

A dynamic Enumeration which allows items to added to the enumeration while it is in use. This is mostly intended for use with SequenceInputStream.

This class is entirely thread safe. Attempting to use the enumeration and to add objects from a single thread is not recommended, as it may deadlock the thread.


Constructor Summary
DynamicEnumeration()
          Creates a new instance of DynamicEnumeration
DynamicEnumeration(List initial)
          Creates a new instance of DynamicEnumeration
 
Method Summary
 void add(Object add)
          Add another object to the enumeration.
 void close()
          There will be no more objects added.
 boolean hasMoreElements()
          

If the Enumeration has not been closed we may have to block until we have a stream to return.

 Object nextElement()
          

If the Enumeration has not been closed we may have to block until we have a stream to return.

 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DynamicEnumeration

public DynamicEnumeration()
Creates a new instance of DynamicEnumeration


DynamicEnumeration

public DynamicEnumeration(List initial)
Creates a new instance of DynamicEnumeration

Method Detail

hasMoreElements

public boolean hasMoreElements()

If the Enumeration has not been closed we may have to block until we have a stream to return.

Specified by:
hasMoreElements in interface Enumeration

nextElement

public Object nextElement()

If the Enumeration has not been closed we may have to block until we have a stream to return.

Specified by:
nextElement in interface Enumeration

add

public void add(Object add)
Add another object to the enumeration.


close

public void close()
There will be no more objects added.


JXTA J2SE