de.schlichtherle.io.archive.zip
Class OdfDriver
java.lang.Object
de.schlichtherle.io.archive.spi.AbstractArchiveDriver
de.schlichtherle.io.archive.zip.ZipDriver
de.schlichtherle.io.archive.zip.JarDriver
de.schlichtherle.io.archive.zip.OdfDriver
- All Implemented Interfaces:
- ArchiveDriver, Serializable
- Direct Known Subclasses:
- CheckedOdfDriver
public class OdfDriver
- extends JarDriver
An archive driver which supports building archive files according to
the specification of the OpenDocument Format (ODF), version 1.1.
This driver ensures that the entry named mimetype, if present at
all, is always written as the first entry and uses the STORED method
rather than the DEFLATED method in the resulting archive file in order
to meet the requirements of section 17.4 of the
OpenDocument Specification,
version 1.1.
Other than this, ODF files are treated like regular JAR files.
In particular, this class does not check an ODF file for the
existance of the META-INF/manifest.xml entry or any other entry.
Instances of this class are immutable.
How to use this driver
An ODF file is either a plain XML file or a JAR file (called package).
If it's an XML file, the method File.isFile()
returns true and this driver is actually never used.
It's up to the client application to recognize this and deal with the
ODF file appropriately.
If it's a JAR file however, the method
File.isDirectory() returns true and
this driver is used to access the file.
The client application can then access the ODF file transparently as if it
were a directory in a path.
If a mimetype entry is to be created or modified, this should be
done first in order to provide best performance.
- Since:
- TrueZIP 6.5
- Version:
- $Id: OdfDriver.java 06f3ba684701 2010/11/04 01:15:55 christian $
- Author:
- Christian Schlichtherle
- See Also:
OdfOutputArchive,
Serialized Form
|
Constructor Summary |
OdfDriver()
Equivalent to this(null, null, false, false, DEFAULT_LEVEL). |
OdfDriver(Icon openIcon,
Icon closedIcon,
boolean preambled,
boolean postambled,
int level)
Constructs a new ODF driver. |
OdfDriver(int level)
Equivalent to this(null, null, false, false, level). |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
OdfDriver
public OdfDriver()
- Equivalent to
this(null, null, false, false, DEFAULT_LEVEL).
OdfDriver
public OdfDriver(int level)
- Equivalent to
this(null, null, false, false, level).
OdfDriver
public OdfDriver(Icon openIcon,
Icon closedIcon,
boolean preambled,
boolean postambled,
int level)
- Constructs a new ODF driver.
createOutputArchive
public OutputArchive createOutputArchive(Archive archive,
OutputStream out,
InputArchive source)
throws IOException
- Description copied from class:
ZipDriver
- Creates a new output archive for
archive
from the given output stream.
The implementation in ZipDriver simply forwards the call to
ZipDriver.createZipOutputArchive(de.schlichtherle.io.archive.Archive, java.io.OutputStream, de.schlichtherle.io.archive.zip.ZipInputArchive) and wraps the result in a new
MultiplexedOutputArchive.
- Specified by:
createOutputArchive in interface ArchiveDriver- Overrides:
createOutputArchive in class ZipDriver
- Parameters:
archive - The abstract archive representation which TrueZIP's
internal ArchiveController is processing
- never null.out - The OutputStream to write the archive entries to
- never null.source - The source InputArchive if
archive is going to get updated.
If not null, this is guaranteed to be a product
of this driver's ArchiveDriver.createInputArchive(de.schlichtherle.io.archive.Archive, de.schlichtherle.io.rof.ReadOnlyFile) method.
This may be used to copy some meta data which is specific to
the type of archive this driver supports.
For example, this could be used to copy the comment of a ZIP
file.
- Returns:
- A new output archive instance.
- Throws:
TransientIOException - If calling this method for the same
archive file again may finally succeed.
This exception is associated with another IOException
as its cause which is unwrapped and interpreted as below.
FileNotFoundException - If the output archive is inaccessible
for any reason.
IOException - On any other I/O or data format related issue
when writing the output archive.- See Also:
OutputArchive
Copyright © 2005-2011 Schlichtherle IT Services. All Rights Reserved.