public class TLcyCompositeOutputStreamFactory extends TLcyGenericComposite<ILcdOutputStreamFactory> implements ILcdOutputStreamFactory
Composite implementation (see composite design pattern) of ILcdOutputStreamFactory
.
You can use the TLcyCompositeOutputStreamFactory
in two ways:
ILcyLucyEnv
:
ILcdOutputStreamFactory
services registered in the Lucy back-end until one succeeds.
TLcyCompositeOutputStreamFactory
s will add and remove the
factory as a service in the Lucy back-end.
ILcyLucyEnv
:
ILcdOutputStreamFactory
registered in this instance until one succeeds.
TLcyCompositeOutputStreamFactory
s will only be performed
on this instance.
You can also loop over the underlying ILcdOutputStreamFactory
s yourself using the
standard iterator.
ILcdOutputStreamFactory
PRIORITY_DEFAULT, PRIORITY_FALLBACK
Constructor and Description |
---|
TLcyCompositeOutputStreamFactory()
Create 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.
|
Modifier and Type | Method and Description |
---|---|
OutputStream |
createOutputStream(String aSource)
Loops over the factories in the local instance or Lucy back-end, depending on the usage.
|
add, add, getList, getPriority, iterator, remove
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
forEach, spliterator
public TLcyCompositeOutputStreamFactory()
public TLcyCompositeOutputStreamFactory(ILcyLucyEnv aLucyEnv)
aLucyEnv
- The Lucy back-endpublic OutputStream createOutputStream(String aSource) throws IOException
createOutputStream
in interface ILcdOutputStreamFactory
aSource
- an accessible destination.IOException
. Returns null
if no factories or default factory are registered.IOException
- If none of the available ILcdOutputStreamFactory
instances could create an output stream.