Package com.luciad.lucy.io
Class TLcyCompositeInputStreamFactory
java.lang.Object
com.luciad.lucy.util.TLcyGenericComposite<ILcdInputStreamFactory>
com.luciad.lucy.io.TLcyCompositeInputStreamFactory
- All Implemented Interfaces:
ILcdInputStreamFactory,Iterable<ILcdInputStreamFactory>
public class TLcyCompositeInputStreamFactory
extends TLcyGenericComposite<ILcdInputStreamFactory>
implements ILcdInputStreamFactory
Composite implementation (see composite design pattern) of ILcdInputStreamFactory.
You can use the TLcyCompositeInputStreamFactory in two ways:
- With
ILcyLucyEnv:- When asked to create an inputstream, it loops over the
ILcdInputStreamFactoryservices registered in the Lucy back-end until one succeeds. - Adding and removing
TLcyCompositeInputStreamFactorys will add and remove the factory as a service in the Lucy back-end.
- When asked to create an inputstream, it loops over the
- Without
ILcyLucyEnv:- When asked to create an inputstream, it loops over the
ILcdInputStreamFactoryregistered in this instance until one succeeds. - Adding and removing
TLcyCompositeInputStreamFactorys will only be performed on this instance.
- When asked to create an inputstream, it loops over the
You can also loop over the underlying ILcdInputStreamFactorys yourself using the
standard iterator.
- Since:
- 10.1
- See Also:
-
Field Summary
Fields inherited from class com.luciad.lucy.util.TLcyGenericComposite
PRIORITY_DEFAULT, PRIORITY_FALLBACK -
Constructor Summary
ConstructorsConstructorDescriptionCreate a new empty composite factory that will act on factories registered in this instance only.TLcyCompositeInputStreamFactory(ILcyLucyEnv aLucyEnv) Create a composite factory that will act on the factories registered in the Lucy back-end. -
Method Summary
Modifier and TypeMethodDescriptioncreateInputStream(String aSource) Delegates to the first input stream factory whosecreateInputStream()method does not throw an exception.Methods inherited from class com.luciad.lucy.util.TLcyGenericComposite
add, add, getList, getPriority, iterator, removeMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.luciad.io.ILcdInputStreamFactory
canCreateInputStreamMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Constructor Details
-
TLcyCompositeInputStreamFactory
public TLcyCompositeInputStreamFactory()Create a new empty composite factory that will act on factories registered in this instance only. -
TLcyCompositeInputStreamFactory
Create a composite factory that will act on the factories registered in the Lucy back-end.- Parameters:
aLucyEnv- The Lucy back-end
-
-
Method Details
-
createInputStream
Delegates to the first input stream factory whosecreateInputStream()method does not throw an exception.- Specified by:
createInputStreamin interfaceILcdInputStreamFactory- Parameters:
aSource- an accessible data source.- Returns:
- The InputStream created by the first factory that does not throw
IOException. - Throws:
IOException- If none of the availableILcdInputStreamFactoryinstances could create an input stream.- See Also:
-