KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > de > schlichtherle > util > zip > ZipConstants


1 /*
2  * ZipConstants.java
3  *
4  * Created on 22. Juli 2005, 23:08
5  */

6 /*
7  * Copyright 2005-2006 Schlichtherle IT Services
8  * Copyright 2001-2005 The Apache Software Foundation
9  *
10  * Licensed under the Apache License, Version 2.0 (the "License");
11  * you may not use this file except in compliance with the License.
12  * You may obtain a copy of the License at
13  *
14  * http://www.apache.org/licenses/LICENSE-2.0
15  *
16  * Unless required by applicable law or agreed to in writing, software
17  * distributed under the License is distributed on an "AS IS" BASIS,
18  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19  * See the License for the specific language governing permissions and
20  * limitations under the License.
21  */

22
23 package de.schlichtherle.util.zip;
24
25 /**
26  * Some constants used for ZIP compatible files.
27  *
28  * @author Christian Schlichtherle
29  */

30 interface ZipConstants {
31
32     /**
33      * Local File Header signature.
34      */

35     int LFH_SIG = 0x04034B50;
36     
37     /**
38      * Data Descriptor signature.
39      */

40     int DD_SIG = 0x08074B50;
41     
42     /**
43      * Central File Header signature.
44      */

45     int CFH_SIG = 0x02014B50;
46
47     /**
48      * End Of Central Directory signature.
49      */

50     int EOCD_SIG = 0x06054B50;
51
52     /**
53      * The minimum length of the Local File Header record.
54      */

55     int LFH_MIN_LEN =
56         /* local file header signature */ 4 +
57         /* version needed to extract */ 2 +
58         /* general purpose bit flag */ 2 +
59         /* compression method */ 2 +
60         /* last mod file time */ 2 +
61         /* last mod file date */ 2 +
62         /* crc-32 */ 4 +
63         /* compressed size */ 4 +
64         /* uncompressed size */ 4 +
65         /* file name length */ 2 +
66         /* extra field length */ 2;
67
68     /**
69      * The minimum length of the Central File Header record.
70      */

71     int CFH_MIN_LEN =
72         /* central file header signature */ 4 +
73         /* version made by */ 2 +
74         /* version needed to extract */ 2 +
75         /* general purpose bit flag */ 2 +
76         /* compression method */ 2 +
77         /* last mod file time */ 2 +
78         /* last mod file date */ 2 +
79         /* crc-32 */ 4 +
80         /* compressed size */ 4 +
81         /* uncompressed size */ 4 +
82         /* filename length */ 2 +
83         /* extra field length */ 2 +
84         /* file comment length */ 2 +
85         /* disk number start */ 2 +
86         /* internal file attributes */ 2 +
87         /* external file attributes */ 4 +
88         /* relative offset of local header */ 4;
89
90     /**
91      * The minimum length of the End Of Central Directory record.
92      */

93     int EOCD_MIN_LEN =
94         /* end of central dir signature */ 4 +
95         /* number of this disk */ 2 +
96         /* number of the disk with the */ +
97         /* start of the central directory */ 2 +
98         /* total number of entries in */ +
99         /* the central dir on this disk */ 2 +
100         /* total number of entries in */ +
101         /* the central dir */ 2 +
102         /* size of the central directory */ 4 +
103         /* offset of start of central */ +
104         /* directory with respect to */ +
105         /* the starting disk number */ 4 +
106         /* zipfile comment length */ 2;
107
108     /**
109      * Compression method for uncompressed (stored) entries.
110      */

111     short STORED = 0;
112
113     /**
114      * Compression method for compressed (deflated) entries.
115      */

116     short DEFLATED = 8;
117
118     short PLATFORM_FAT = 0;
119     short PLATFORM_UNIX = 3;
120
121     /**
122      * Smallest date/time ZIP can handle.
123      */

124     long MIN_DOS_TIME = 0x210000l;
125     
126     /**
127      * The default character set used for entry names and comments in a ZIP
128      * compatible file.
129      * This is <tt>JAR_ENCODING</tt> for compatibility with Sun's JDK
130      * implementation.
131      * Note that you should use <tt>ZIP_ENCODING</tt> for ordinary ZIP files
132      * instead.
133      */

134     String JavaDoc DEFAULT_ENCODING = "UTF-8";
135     
136     /**
137      * The buffer size used for deflating and inflating.
138      * Optimized for reading and writing flash memory media.
139      */

140     int FLATER_BUF_LENGTH = 64 * 1024;
141 }
Popular Tags