aboutsummaryrefslogtreecommitdiffstats
path: root/framework/src/ant/apache-ant-1.9.6/src/main/org/apache/tools/tar/TarConstants.java
blob: 06d0faca90664e413677eca3d26c3fd2e1491ccf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
/*
 *  Licensed to the Apache Software Foundation (ASF) under one or more
 *  contributor license agreements.  See the NOTICE file distributed with
 *  this work for additional information regarding copyright ownership.
 *  The ASF licenses this file to You under the Apache License, Version 2.0
 *  (the "License"); you may not use this file except in compliance with
 *  the License.  You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 *
 */

/*
 * This package is based on the work done by Timothy Gerard Endres
 * (time@ice.com) to whom the Ant project is very grateful for his great code.
 */

package org.apache.tools.tar;

/**
 * This interface contains all the definitions used in the package.
 *
 * For tar formats (FORMAT_OLDGNU, FORMAT_POSIX, etc.) see GNU tar
 * <I>tar.h</I> type <I>enum archive_format</I>
 */
// CheckStyle:InterfaceIsTypeCheck OFF (bc)
public interface TarConstants {

    /**
     * GNU format as per before tar 1.12.
     */
    int    FORMAT_OLDGNU = 2;

    /**
     * Pure Posix format.
     */
    int    FORMAT_POSIX = 3;

    /**
     * The length of the name field in a header buffer.
     */
    int    NAMELEN = 100;

    /**
     * The length of the mode field in a header buffer.
     */
    int    MODELEN = 8;

    /**
     * The length of the user id field in a header buffer.
     */
    int    UIDLEN = 8;

    /**
     * The length of the group id field in a header buffer.
     */
    int    GIDLEN = 8;

    /**
     * The maximum value of gid/uid in a tar archive which can
     * be expressed in octal char notation (that's 7 sevens, octal).
     */
    long    MAXID = 07777777L;

    /**
     * The length of the checksum field in a header buffer.
     */
    int    CHKSUMLEN = 8;

    /**
     * The length of the size field in a header buffer.
     * Includes the trailing space or NUL.
     */
    int    SIZELEN = 12;

    /**
     * The maximum size of a file in a tar archive
     * which can be expressed in octal char notation (that's 11 sevens, octal).
     */
    long   MAXSIZE = 077777777777L;

    /** Offset of start of magic field within header record */
    int    MAGIC_OFFSET = 257;
    /**
     * The length of the magic field in a header buffer including the version.
     */
    int    MAGICLEN = 8;

    /**
     * The length of the magic field in a header buffer.
     */
    int    PURE_MAGICLEN = 6;

    /** Offset of start of magic field within header record */
    int    VERSION_OFFSET = 263;
    /**
     * Previously this was regarded as part of "magic" field, but it
     * is separate.
     */
    int    VERSIONLEN = 2;

    /**
     * The length of the modification time field in a header buffer.
     */
    int    MODTIMELEN = 12;

    /**
     * The length of the user name field in a header buffer.
     */
    int    UNAMELEN = 32;

    /**
     * The length of the group name field in a header buffer.
     */
    int    GNAMELEN = 32;

    /**
     * The length of each of the device fields (major and minor) in a header buffer.
     */
    int    DEVLEN = 8;

    /**
     * Length of the prefix field.
     *
     */
    int    PREFIXLEN = 155;

    /**
     * The length of the access time field in an old GNU header buffer.
     *
     */
    int    ATIMELEN_GNU = 12;

    /**
     * The length of the created time field in an old GNU header buffer.
     *
     */
    int    CTIMELEN_GNU = 12;

    /**
     * The length of the multivolume start offset field in an old GNU header buffer.
     *
     */
    int    OFFSETLEN_GNU = 12;

    /**
     * The length of the long names field in an old GNU header buffer.
     *
     */
    int    LONGNAMESLEN_GNU = 4;

    /**
     * The length of the padding field in an old GNU header buffer.
     *
     */
    int    PAD2LEN_GNU = 1;

    /**
     * The sum of the length of all sparse headers in an old GNU header buffer.
     *
     */
    int    SPARSELEN_GNU = 96;

    /**
     * The length of the is extension field in an old GNU header buffer.
     *
     */
    int    ISEXTENDEDLEN_GNU = 1;

    /**
     * The length of the real size field in an old GNU header buffer.
     *
     */
    int    REALSIZELEN_GNU = 12;

    /**
     * The sum of the length of all sparse headers in a sparse header buffer.
     *
     */
    int    SPARSELEN_GNU_SPARSE = 504;

    /**
     * The length of the is extension field in a sparse header buffer.
     *
     */
    int    ISEXTENDEDLEN_GNU_SPARSE = 1;

    /**
     * LF_ constants represent the "link flag" of an entry, or more commonly,
     * the "entry type". This is the "old way" of indicating a normal file.
     */
    byte   LF_OLDNORM = 0;

    /**
     * Normal file type.
     */
    byte   LF_NORMAL = (byte) '0';

    /**
     * Link file type.
     */
    byte   LF_LINK = (byte) '1';

    /**
     * Symbolic link file type.
     */
    byte   LF_SYMLINK = (byte) '2';

    /**
     * Character device file type.
     */
    byte   LF_CHR = (byte) '3';

    /**
     * Block device file type.
     */
    byte   LF_BLK = (byte) '4';

    /**
     * Directory file type.
     */
    byte   LF_DIR = (byte) '5';

    /**
     * FIFO (pipe) file type.
     */
    byte   LF_FIFO = (byte) '6';

    /**
     * Contiguous file type.
     */
    byte   LF_CONTIG = (byte) '7';

    /**
     * Identifies the *next* file on the tape as having a long linkname.
     */
    byte LF_GNUTYPE_LONGLINK = (byte) 'K';

    /**
     * Identifies the *next* file on the tape as having a long name.
     */
    byte LF_GNUTYPE_LONGNAME = (byte) 'L';

    /**
     * Sparse file type.
     */
    byte LF_GNUTYPE_SPARSE = (byte) 'S';

    // See "http://www.opengroup.org/onlinepubs/009695399/utilities/pax.html#tag_04_100_13_02"

    /**
     * Identifies the entry as a Pax extended header.
     */
    byte LF_PAX_EXTENDED_HEADER_LC = (byte) 'x';

    /**
     * Identifies the entry as a Pax extended header (SunOS tar -E).
     */
    byte LF_PAX_EXTENDED_HEADER_UC = (byte) 'X';

    /**
     * Identifies the entry as a Pax global extended header.
     */
    byte LF_PAX_GLOBAL_EXTENDED_HEADER = (byte) 'g';

    String TMAGIC = "ustar";

    /**
     * The magic tag representing a POSIX tar archive.
     */
    String MAGIC_POSIX = "ustar\0";
    String VERSION_POSIX = "00";

    /**
     * The magic tag representing a GNU tar archive.
     */
    String GNU_TMAGIC = "ustar  ";
    // Appear to be two possible GNU versions
    String VERSION_GNU_SPACE = " \0";
    String VERSION_GNU_ZERO  = "0\0";

    /**
     * The name of the GNU tar entry which contains a long name.
     */
    String GNU_LONGLINK = "././@LongLink";

}