TrueZIP 6.8.1

de.schlichtherle.io.archive.zip
Class OdfOutputArchive

java.lang.Object
  extended by de.schlichtherle.io.archive.spi.MultiplexedOutputArchive
      extended by de.schlichtherle.io.archive.zip.OdfOutputArchive
All Implemented Interfaces:
OutputArchive

public class OdfOutputArchive
extends MultiplexedOutputArchive

Created by OdfDriver to meet the special requirements of OpenDocument Format (ODF) files.

Version:
$Id: OdfOutputArchive.java,v 1.4 2010/08/20 13:09:51 christian_schlichtherle Exp $
Author:
Christian Schlichtherle

Constructor Summary
OdfOutputArchive(OutputArchive target)
          Creates a new OdfOutputArchive.
 
Method Summary
 void close()
          Closes this output archive and releases any system resources associated with it.
 OutputStream getOutputStream(ArchiveEntry entry, ArchiveEntry srcEntry)
          Returns a new OutputStream for writing the contents of the given archive entry.
 boolean isTargetBusy()
          Returns whether the target output archive is busy writing an archive entry or not.
 
Methods inherited from class de.schlichtherle.io.archive.spi.MultiplexedOutputArchive
getArchiveEntries, getArchiveEntry, getMetaData, getNumArchiveEntries, setMetaData, storeDirectory
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OdfOutputArchive

public OdfOutputArchive(OutputArchive target)
Creates a new OdfOutputArchive.

Method Detail

getOutputStream

public OutputStream getOutputStream(ArchiveEntry entry,
                                    ArchiveEntry srcEntry)
                             throws IOException
Description copied from interface: OutputArchive
Returns a new OutputStream for writing the contents of the given archive entry.

The returned stream should preferrably be unbuffered, as buffering is usually done in higher layers (all copy routines in TrueZIP do this and most client applications do it, too). Buffering twice does not increase, but decrease performance.

Note that the stream is guaranteed to be closed before the OutputArchive.close() method of this archive is called!

Specified by:
getOutputStream in interface OutputArchive
Overrides:
getOutputStream in class MultiplexedOutputArchive
Parameters:
entry - A valid reference to an archive entry. The runtime class of this entry is the same as the runtime class of the entries returned by ArchiveDriver.createArchiveEntry(de.schlichtherle.io.archive.Archive, java.lang.String, de.schlichtherle.io.archive.spi.ArchiveEntry).
srcEntry - If not null, this identifies the entry from which TrueZIP is actually copying data from and should be used to implement the Direct Data Copying (DDC) feature. Note that there is no guarantee on the runtime type of this object; it may have been created by other drivers. Furthermore, this not exclusively used for archive copies, so you should not simply copy all properties of the source entry to the entry (see ArchiveDriver.createArchiveEntry(Archive, String, ArchiveEntry) for comparison).

For example, the ZIP driver family uses this to copy the already deflated data if the source entry is another ZIP file entry. As another example, the TarDriver uses this to determine the size of the input file, thereby removing the need to create (yet another) temporary file.

Returns:
A (preferrably unbuffered) OutputStream to write the archive entry data to. null is not allowed!
Throws:
OutputArchiveBusyException - If the archive is currently busy on output for another entry. This exception is guaranteed to be recoverable, meaning it should be possible to write the same entry again as soon as the archive is not busy on output anymore.
FileNotFoundException - If the archive entry is not accessible for some reason.
IOException - On any other exceptional condition.

isTargetBusy

public boolean isTargetBusy()
Description copied from class: MultiplexedOutputArchive
Returns whether the target output archive is busy writing an archive entry or not.

Overrides:
isTargetBusy in class MultiplexedOutputArchive

close

public void close()
           throws IOException
Description copied from interface: OutputArchive
Closes this output archive and releases any system resources associated with it.

Specified by:
close in interface OutputArchive
Overrides:
close in class MultiplexedOutputArchive
Throws:
IOException - On any I/O related issue.

TrueZIP 6.8.1

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