1 /*
2 * Licensed to the Apache Software Foundation (ASF) under one
3 * or more contributor license agreements. See the NOTICE file
4 * distributed with this work for additional information
5 * regarding copyright ownership. The ASF licenses this file
6 * to you under the Apache License, Version 2.0 (the
7 * "License"); you may not use this file except in compliance
8 * with the License. You may obtain a copy of the License at
9 *
10 * https://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing,
13 * software distributed under the License is distributed on an
14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 * KIND, either express or implied. See the License for the
16 * specific language governing permissions and limitations
17 * under the License.
18 */
19 package org.apache.commons.compress.archivers.zip;
20
21 /**
22 * Various constants used throughout the package.
23 *
24 * @since 1.3
25 */
26 final class ZipConstants {
27 /** Masks last eight bits */
28 static final int BYTE_MASK = 0xFF;
29
30 /** Length of a ZipShort in bytes */
31 static final int SHORT = 2;
32
33 /** Length of a ZipLong in bytes */
34 static final int WORD = 4;
35
36 /** Length of a ZipEightByteInteger in bytes */
37 static final int DWORD = 8;
38
39 /** Initial ZIP specification version */
40 static final int INITIAL_VERSION = 10;
41
42 /**
43 * ZIP specification version that introduced DEFLATE compression method.
44 *
45 * @since 1.15
46 */
47 static final int DEFLATE_MIN_VERSION = 20;
48
49 /** ZIP specification version that introduced data descriptor method */
50 static final int DATA_DESCRIPTOR_MIN_VERSION = 20;
51
52 /** ZIP specification version that introduced ZIP64 */
53 static final int ZIP64_MIN_VERSION = 45;
54
55 /**
56 * Value stored in two-byte size and similar fields if ZIP64 extensions are used.
57 */
58 static final int ZIP64_MAGIC_SHORT = 0xFFFF;
59
60 /**
61 * Value stored in four-byte size and similar fields if ZIP64 extensions are used.
62 */
63 static final long ZIP64_MAGIC = 0xFFFFFFFFL;
64
65 private ZipConstants() {
66 }
67
68 }