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

net.java.truevfs.comp.zipdriver.JarDriver Maven / Gradle / Ivy

/*
 * Copyright (C) 2005-2015 Schlichtherle IT Services.
 * All rights reserved. Use is subject to license terms.
 */
package net.java.truevfs.comp.zipdriver;

import java.nio.charset.Charset;
import javax.annotation.concurrent.Immutable;
import net.java.truevfs.comp.zip.DateTimeConverter;
import net.java.truevfs.comp.zip.ZipEntry;

/**
 * An archive driver for Java Archive files (JAR).
 * JAR files use the UTF-8 character set for the encoding of entry
 * names and comments.
 * They also apply the date/time conversion rules according to
 * {@link DateTimeConverter#JAR}.
 * This configuration makes this driver applicable for all countries.
 * However, it pretty much constrains the interoperability of this driver to
 * Java applications and Info-ZIP.
 * Therefore, while you should not use this driver to access plain old
 * ZIP files, you should definitely use it for custom application file formats
 * 

* Other than this, JAR files are treated like plain old ZIP files. * In particular, this class does not check or ensure a certain * directory structure or the existance of certain entries (e.g. * {@code META-INF/MANIFEST.MF}) within a JAR file. *

* This driver does not check the CRC value of any entries in existing * archives - use {@link CheckedJarDriver} instead. *

* Sub-classes must be thread-safe and should be immutable! * * @author Christian Schlichtherle */ @Immutable public class JarDriver extends AbstractZipDriver { /** * The character set for entry names and comments in JAR files, which is * {@code "UTF-8"}. */ public static final Charset JAR_CHARSET = Charset.forName("UTF-8"); /** * {@inheritDoc} * * @return {@link #JAR_CHARSET}. */ @Override public Charset getCharset() { return JAR_CHARSET; } @Override public JarDriverEntry newEntry(String name) { return new JarDriverEntry(name); } @Override public JarDriverEntry newEntry(String name, ZipEntry template) { return new JarDriverEntry(name, template); } }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy