All Downloads are FREE. Search and download functionalities are using the official Maven repository.

de.schlichtherle.truezip.fs.archive.zip.OdfDriver Maven / Gradle / Ivy

Go to download

The file system driver family for ZIP and related archive file types. Add the JAR artifact of this module to the run time class path to make its file system drivers available for service location in the client API modules.

There is a newer version: 7.7.10
Show newest version
/*
 * Copyright (C) 2005-2013 Schlichtherle IT Services.
 * All rights reserved. Use is subject to license terms.
 */
package de.schlichtherle.truezip.fs.archive.zip;

import de.schlichtherle.truezip.fs.FsModel;
import de.schlichtherle.truezip.socket.IOPool;
import de.schlichtherle.truezip.socket.IOPoolProvider;
import de.schlichtherle.truezip.socket.MultiplexedOutputShop;
import de.schlichtherle.truezip.socket.OutputShop;
import java.io.IOException;
import java.io.OutputStream;
import javax.annotation.concurrent.Immutable;

/**
 * An archive driver for application archive files according to the Open
 * Document Format (ODF) Specification, V1.0 and later.
 * This driver simply ensures that an entry named {@code mimetype}, if present
 * at all, is always written as the very first entry using the method
 * {@code STORED} rather than {@code DEFLATED} in the resulting archive file
 * in order to meet the requirements of the ODF Specification.
 * Other than this, ODF files are treated like regular JAR files.
 * In particular, this class does not check an ODF file for the
 * existence of the {@code META-INF/manifest.xml} entry or any other entry.
 * 

* When using this driver to create or modify an ODF file, then in order to * achieve best performance, the {@code mimetype} entry should always get * written first in order to avoid temp file buffering of all other entries. *

* Subclasses must be thread-safe and should be immutable! * * @see Open Document Format for Office Applications (OpenDocument) v1.0; Section 17.4: MIME Type Stream * @see Open Document Format for Office Applications (OpenDocument) v1.1; Section 17.4: MIME Type Stream * @see Open Document Format for Office Applications (OpenDocument) Version 1.2; Part 3: Packages; Section 3.3: MIME Type Stream * @see OdfOutputShop * @author Christian Schlichtherle */ @Immutable public class OdfDriver extends JarDriver { public OdfDriver(IOPoolProvider provider) { super(provider); } @Override @edu.umd.cs.findbugs.annotations.SuppressWarnings("OBL_UNSATISFIED_OBLIGATION") protected OutputShop newOutputShop( final FsModel model, final OutputStream out, final ZipInputShop source) throws IOException { final ZipOutputShop shop = new ZipOutputShop(this, model, out, source); final IOPool pool = getPool(); return null != source && source.isAppendee() ? new MultiplexedOutputShop(shop, pool) : new OdfOutputShop(shop, pool); } }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy