Package com.luciad.lucy.io
Class TLcyCompositeOutputStreamFactory
java.lang.Object
com.luciad.lucy.util.TLcyGenericComposite<ILcdOutputStreamFactory>
com.luciad.lucy.io.TLcyCompositeOutputStreamFactory
- All Implemented Interfaces:
ILcdOutputStreamFactory
,Iterable<ILcdOutputStreamFactory>
public class TLcyCompositeOutputStreamFactory
extends TLcyGenericComposite<ILcdOutputStreamFactory>
implements ILcdOutputStreamFactory
Composite implementation (see composite design pattern) of ILcdOutputStreamFactory
.
You can use the TLcyCompositeOutputStreamFactory
in two ways:
- With
ILcyLucyEnv
:- When asked to create an outputstream, it loops over the
ILcdOutputStreamFactory
services registered in the Lucy back-end until one succeeds. - Adding and removing
TLcyCompositeOutputStreamFactory
s will add and remove the factory as a service in the Lucy back-end.
- When asked to create an outputstream, it loops over the
- Without
ILcyLucyEnv
:- When asked to create an outputstream, it loops over the
ILcdOutputStreamFactory
registered in this instance until one succeeds. - Adding and removing
TLcyCompositeOutputStreamFactory
s will only be performed on this instance.
- When asked to create an outputstream, it loops over the
You can also loop over the underlying ILcdOutputStreamFactory
s 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
ConstructorDescriptionCreate a new empty composite factory that will act on factories registered in this instance only.TLcyCompositeOutputStreamFactory
(ILcyLucyEnv aLucyEnv) Create a composite factory that will act on the factories registered in the Lucy back-end. -
Method Summary
Modifier and TypeMethodDescriptioncreateOutputStream
(String aSource) Loops over the factories in the local instance or Lucy back-end, depending on the usage.Methods inherited from class com.luciad.lucy.util.TLcyGenericComposite
add, add, getList, getPriority, iterator, remove
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Constructor Details
-
TLcyCompositeOutputStreamFactory
public TLcyCompositeOutputStreamFactory()Create a new empty composite factory that will act on factories registered in this instance only. -
TLcyCompositeOutputStreamFactory
Create a composite factory that will act on the factories registered in the Lucy back-end.- Parameters:
aLucyEnv
- The Lucy back-end
-
-
Method Details
-
createOutputStream
Loops over the factories in the local instance or Lucy back-end, depending on the usage.- Specified by:
createOutputStream
in interfaceILcdOutputStreamFactory
- Parameters:
aSource
- an accessible destination.- Returns:
- The OutputStream created by the first factory that does not throw
IOException
. Returnsnull
if no factories or default factory are registered. - Throws:
IOException
- If none of the availableILcdOutputStreamFactory
instances could create an output stream.
-