TrueZIP Driver ZIP 7.1

de.schlichtherle.truezip.fs.archive.zip
Class ZipOutputShop

java.lang.Object
  extended by java.io.OutputStream
      extended by de.schlichtherle.truezip.io.DecoratingOutputStream
          extended by de.schlichtherle.truezip.zip.RawZipOutputStream<ZipArchiveEntry>
              extended by de.schlichtherle.truezip.fs.archive.zip.ZipOutputShop
All Implemented Interfaces:
EntryContainer<ZipArchiveEntry>, OutputService<ZipArchiveEntry>, OutputShop<ZipArchiveEntry>, Closeable, Flushable, Iterable<ZipArchiveEntry>

@DefaultAnnotation(value=edu.umd.cs.findbugs.annotations.NonNull.class)
public class ZipOutputShop
extends RawZipOutputStream<ZipArchiveEntry>
implements OutputShop<ZipArchiveEntry>

An implementation of OutputShop to write ZIP archives.

This output archive can only write one entry at a time. Archive drivers may wrap this class in a FsMultiplexedArchiveOutputShop to overcome this limitation.

Author:
Christian Schlichtherle
See Also:
ZipInputShop

Nested Class Summary
private  class ZipOutputShop.EntryOutputStream
          This entry output stream writes directly to our subclass.
private  class ZipOutputShop.StoredEntryOutputStream
          This entry output stream writes the entry to a temporary file.
 
Field Summary
private  IOPool<?> pool
           
private  IOPool.Entry<?> postamble
           
private  ZipArchiveEntry tempEntry
           
 
Fields inherited from class de.schlichtherle.truezip.zip.RawZipOutputStream
DEFAULT_CHARSET
 
Fields inherited from class de.schlichtherle.truezip.io.DecoratingOutputStream
delegate
 
Constructor Summary
ZipOutputShop(ZipDriver driver, OutputStream out, ZipInputShop source)
           
 
Method Summary
 void close()
          Retains the postamble of the source source ZIP file, if any.
 ZipArchiveEntry getEntry(String name)
          Returns the entry for the given name or null if no entry with this name exists.
 OutputSocket<ZipArchiveEntry> getOutputSocket(ZipArchiveEntry entry)
           
 int getSize()
           
 boolean isBusy()
          Returns whether this output archive is busy writing an archive entry or not.
 Iterator<ZipArchiveEntry> iterator()
          Returns an iteration of all entries written to this ZIP file so far.
 
Methods inherited from class de.schlichtherle.truezip.zip.RawZipOutputStream
closeEntry, entries, finish, getCharset, getComment, getLevel, getMethod, length, putNextEntry, putNextEntry, setComment, setLevel, setMethod, size, write, write
 
Methods inherited from class de.schlichtherle.truezip.io.DecoratingOutputStream
flush, toString, write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

pool

private final IOPool<?> pool

postamble

@CheckForNull
private IOPool.Entry<?> postamble

tempEntry

@Nullable
private ZipArchiveEntry tempEntry
Constructor Detail

ZipOutputShop

public ZipOutputShop(ZipDriver driver,
                     OutputStream out,
                     @CheckForNull
                     ZipInputShop source)
              throws IOException
Throws:
IOException
Method Detail

getSize

public int getSize()
Specified by:
getSize in interface EntryContainer<ZipArchiveEntry>

iterator

public Iterator<ZipArchiveEntry> iterator()
Description copied from class: RawZipOutputStream
Returns an iteration of all entries written to this ZIP file so far. Note that the iteration supports element removal and the returned entries are shared with this instance. It is illegal to put more entries into this ZIP output stream concurrently or modify the state of the iterated entries.

Specified by:
iterator in interface EntryContainer<ZipArchiveEntry>
Specified by:
iterator in interface Iterable<ZipArchiveEntry>
Overrides:
iterator in class RawZipOutputStream<ZipArchiveEntry>

getEntry

@CheckForNull
public ZipArchiveEntry getEntry(String name)
Description copied from class: RawZipOutputStream
Returns the entry for the given name or null if no entry with this name exists. Note that the returned entry is shared with this instance. It is illegal to change its state!

Specified by:
getEntry in interface EntryContainer<ZipArchiveEntry>
Overrides:
getEntry in class RawZipOutputStream<ZipArchiveEntry>
Parameters:
name - the name of the ZIP entry.

getOutputSocket

public OutputSocket<ZipArchiveEntry> getOutputSocket(ZipArchiveEntry entry)
Specified by:
getOutputSocket in interface OutputService<ZipArchiveEntry>

isBusy

public final boolean isBusy()
Returns whether this output archive is busy writing an archive entry or not.

Overrides:
isBusy in class RawZipOutputStream<ZipArchiveEntry>

close

public void close()
           throws IOException
Retains the postamble of the source source ZIP file, if any.

Specified by:
close in interface Closeable
Overrides:
close in class RawZipOutputStream<ZipArchiveEntry>
Throws:
IOException - On any I/O related issue.

TrueZIP Driver ZIP 7.1

Copyright © 2005-2011 Schlichtherle IT Services. All Rights Reserved.