AE - The type of the archive entries.@NotThreadSafe @DefaultAnnotation(value=edu.umd.cs.findbugs.annotations.NonNull.class) public class FsMultiplexedArchiveOutputShop<AE extends FsArchiveEntry> extends DecoratingOutputShop<AE,OutputShop<AE>>
OutputShop in order to support a virtually
unlimited number of entries which may be written concurrently while
actually at most one entry is written concurrently to the output archive
output.
If there is more than one entry to be written concurrently, the additional
entries are actually written to temp files and copied to the output
output archive upon a call to their OutputStream.close() method.
Note that this implies that the close() method may fail with
an IOException.| Modifier and Type | Class and Description |
|---|---|
private class |
FsMultiplexedArchiveOutputShop.EntryOutputStream
This entry output stream writes directly to the output archive.
|
private class |
FsMultiplexedArchiveOutputShop.TempEntriesIterator |
private class |
FsMultiplexedArchiveOutputShop.TempEntryOutputStream
This entry output stream writes the archive entry to a temporary file.
|
| Modifier and Type | Field and Description |
|---|---|
private boolean |
busy |
private IOPool<?> |
pool |
private Map<String,FsMultiplexedArchiveOutputShop.TempEntryOutputStream> |
temps
The map of temporary archive entries which have not yet been written
to the output output archive.
|
delegate| Constructor and Description |
|---|
FsMultiplexedArchiveOutputShop(OutputShop<AE> output,
IOPool<?> pool)
Constructs a new
FsMultiplexedArchiveOutputShop. |
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
AE |
getEntry(String name)
Returns the entry for the given
name or
null if no entry with this name exists in this container. |
OutputSocket<? extends AE> |
getOutputSocket(AE entry)
Returns an output socket for writing to the given entry.
|
int |
getSize()
Returns the number of entries in this container.
|
boolean |
isBusy()
Returns whether the container output archive is busy writing an archive
entry or not.
|
Iterator<AE> |
iterator()
Returns a new iterator over all entries in this container.
|
private void |
storeTemps() |
toStringprivate final IOPool<?> pool
private final Map<String,FsMultiplexedArchiveOutputShop.TempEntryOutputStream> temps
private boolean busy
isBusy()public FsMultiplexedArchiveOutputShop(OutputShop<AE> output, IOPool<?> pool)
FsMultiplexedArchiveOutputShop.output - the decorated output archive.NullPointerException - iff output is null.public int getSize()
EntryContainergetSize in interface EntryContainer<AE extends FsArchiveEntry>getSize in class DecoratingEntryContainer<AE extends FsArchiveEntry,OutputShop<AE extends FsArchiveEntry>>public Iterator<AE> iterator()
EntryContainerFirst, the iteration must be consistent: Multiple iterators must iterate the same entries in the same order again unless the set of entries has changed.
Next, the iteration should also reflect the natural order of the entries in this container. For example, if this container represents an archive file, the iteration should reflect the natural order of the entries in the archive file.
iterator in interface EntryContainer<AE extends FsArchiveEntry>iterator in interface Iterable<AE extends FsArchiveEntry>iterator in class DecoratingEntryContainer<AE extends FsArchiveEntry,OutputShop<AE extends FsArchiveEntry>>@CheckForNull public AE getEntry(String name)
EntryContainername or
null if no entry with this name exists in this container.getEntry in interface EntryContainer<AE extends FsArchiveEntry>getEntry in class DecoratingEntryContainer<AE extends FsArchiveEntry,OutputShop<AE extends FsArchiveEntry>>name - an entry name.name or
null if no entry with this name exists in this container.public OutputSocket<? extends AE> getOutputSocket(AE entry)
OutputServicegetOutputSocket in interface OutputService<AE extends FsArchiveEntry>getOutputSocket in class DecoratingOutputShop<AE extends FsArchiveEntry,OutputShop<AE extends FsArchiveEntry>>entry - the entry, which will be the
local target of the returned
output socket.public boolean isBusy()
public void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableclose in class DecoratingOutputShop<AE extends FsArchiveEntry,OutputShop<AE extends FsArchiveEntry>>IOExceptionprivate void storeTemps()
throws IOException
IOExceptionCopyright © 2005-2011 Schlichtherle IT Services. All Rights Reserved.