001/*
002 * Licensed to the Apache Software Foundation (ASF) under one
003 * or more contributor license agreements.  See the NOTICE file
004 * distributed with this work for additional information
005 * regarding copyright ownership.  The ASF licenses this file
006 * to you under the Apache License, Version 2.0 (the
007 * "License"); you may not use this file except in compliance
008 * with the License.  You may obtain a copy of the License at
009 *
010 *   https://www.apache.org/licenses/LICENSE-2.0
011 *
012 * Unless required by applicable law or agreed to in writing,
013 * software distributed under the License is distributed on an
014 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
015 * KIND, either express or implied.  See the License for the
016 * specific language governing permissions and limitations
017 * under the License.
018 */
019
020package org.apache.commons.compress.archivers.zip;
021
022/**
023 * Enumerates the different modes {@link ZipArchiveOutputStream} can operate in.
024 *
025 * @see ZipArchiveOutputStream#setUseZip64
026 * @since 1.3
027 */
028public enum Zip64Mode {
029
030    /**
031     * Use Zip64 extensions for all entries, even if it is clear it is not required.
032     */
033    Always,
034
035    /**
036     * Don't use Zip64 extensions for any entries.
037     *
038     * <p>
039     * This will cause a {@link Zip64RequiredException} to be thrown if {@link ZipArchiveOutputStream} detects it needs Zip64 support.
040     * </p>
041     */
042    Never,
043
044    /**
045     * Use Zip64 extensions for all entries where they are required, don't use them for entries that clearly don't require them.
046     */
047    AsNeeded,
048
049    /**
050     * Always use Zip64 extensions for LFH and central directory as {@link Zip64Mode#Always} did, and at the meantime encode the relative offset of LFH and disk
051     * number start as needed in CFH as {@link Zip64Mode#AsNeeded} did.
052     * <p>
053     * This is a compromise for some libraries including 7z and Expand-Archive Powershell utility(and likely Excel).
054     */
055    AlwaysWithCompatibility
056}