blob: 00aebe77bdca021bf92aae09ff50c6cb59b3abcd [file] [log] [blame]
Torsten Curdtca165392008-07-10 10:17:44 +00001/*
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 * http://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 */
19package org.apache.commons.compress.archivers.tar;
20
21/**
22 * This interface contains all the definitions used in the package.
Torsten Curdt46ad24d2009-01-08 11:09:25 +000023 *
Torsten Curdtca165392008-07-10 10:17:44 +000024 */
Torsten Curdt46ad24d2009-01-08 11:09:25 +000025// CheckStyle:InterfaceIsTypeCheck OFF (bc)
26public interface TarConstants {
27
28 /**
29 * The length of the name field in a header buffer.
30 */
31 int NAMELEN = 100;
32
Torsten Curdtca165392008-07-10 10:17:44 +000033 /**
34 * The length of the mode field in a header buffer.
35 */
Torsten Curdt46ad24d2009-01-08 11:09:25 +000036 int MODELEN = 8;
Torsten Curdtca165392008-07-10 10:17:44 +000037
38 /**
39 * The length of the user id field in a header buffer.
40 */
Torsten Curdt46ad24d2009-01-08 11:09:25 +000041 int UIDLEN = 8;
Torsten Curdtca165392008-07-10 10:17:44 +000042
43 /**
44 * The length of the group id field in a header buffer.
45 */
Torsten Curdt46ad24d2009-01-08 11:09:25 +000046 int GIDLEN = 8;
Torsten Curdtca165392008-07-10 10:17:44 +000047
48 /**
49 * The length of the checksum field in a header buffer.
50 */
Torsten Curdt46ad24d2009-01-08 11:09:25 +000051 int CHKSUMLEN = 8;
Torsten Curdtca165392008-07-10 10:17:44 +000052
53 /**
54 * The length of the size field in a header buffer.
55 */
Torsten Curdt46ad24d2009-01-08 11:09:25 +000056 int SIZELEN = 12;
57
58 /**
59 * The maximum size of a file in a tar archive (That's 11 sevens, octal).
60 */
61 long MAXSIZE = 077777777777L;
Torsten Curdtca165392008-07-10 10:17:44 +000062
63 /**
64 * The length of the magic field in a header buffer.
65 */
Sebastian Bazley24f9c9b2009-04-02 15:19:17 +000066 int MAGICLEN = 8; // TODO split this into MAGICLEN=6 and VERSIONLEN=2
Torsten Curdtca165392008-07-10 10:17:44 +000067
68 /**
69 * The length of the modification time field in a header buffer.
70 */
Torsten Curdt46ad24d2009-01-08 11:09:25 +000071 int MODTIMELEN = 12;
Torsten Curdtca165392008-07-10 10:17:44 +000072
73 /**
74 * The length of the user name field in a header buffer.
75 */
Torsten Curdt46ad24d2009-01-08 11:09:25 +000076 int UNAMELEN = 32;
Torsten Curdtca165392008-07-10 10:17:44 +000077
78 /**
79 * The length of the group name field in a header buffer.
80 */
Torsten Curdt46ad24d2009-01-08 11:09:25 +000081 int GNAMELEN = 32;
Torsten Curdtca165392008-07-10 10:17:44 +000082
83 /**
Sebastian Bazley24f9c9b2009-04-02 15:19:17 +000084 * The length of each of the device fields (major and minor) in a header buffer.
Torsten Curdtca165392008-07-10 10:17:44 +000085 */
Torsten Curdt46ad24d2009-01-08 11:09:25 +000086 int DEVLEN = 8;
Torsten Curdtca165392008-07-10 10:17:44 +000087
88 /**
89 * LF_ constants represent the "link flag" of an entry, or more commonly,
90 * the "entry type". This is the "old way" of indicating a normal file.
91 */
Torsten Curdt46ad24d2009-01-08 11:09:25 +000092 byte LF_OLDNORM = 0;
Torsten Curdtca165392008-07-10 10:17:44 +000093
94 /**
95 * Normal file type.
96 */
Torsten Curdt46ad24d2009-01-08 11:09:25 +000097 byte LF_NORMAL = (byte) '0';
Torsten Curdtca165392008-07-10 10:17:44 +000098
99 /**
100 * Link file type.
101 */
Torsten Curdt46ad24d2009-01-08 11:09:25 +0000102 byte LF_LINK = (byte) '1';
Torsten Curdtca165392008-07-10 10:17:44 +0000103
104 /**
105 * Symbolic link file type.
106 */
Torsten Curdt46ad24d2009-01-08 11:09:25 +0000107 byte LF_SYMLINK = (byte) '2';
Torsten Curdtca165392008-07-10 10:17:44 +0000108
109 /**
110 * Character device file type.
111 */
Torsten Curdt46ad24d2009-01-08 11:09:25 +0000112 byte LF_CHR = (byte) '3';
Torsten Curdtca165392008-07-10 10:17:44 +0000113
114 /**
115 * Block device file type.
116 */
Torsten Curdt46ad24d2009-01-08 11:09:25 +0000117 byte LF_BLK = (byte) '4';
Torsten Curdtca165392008-07-10 10:17:44 +0000118
119 /**
120 * Directory file type.
121 */
Torsten Curdt46ad24d2009-01-08 11:09:25 +0000122 byte LF_DIR = (byte) '5';
Torsten Curdtca165392008-07-10 10:17:44 +0000123
124 /**
125 * FIFO (pipe) file type.
126 */
Torsten Curdt46ad24d2009-01-08 11:09:25 +0000127 byte LF_FIFO = (byte) '6';
Torsten Curdtca165392008-07-10 10:17:44 +0000128
129 /**
130 * Contiguous file type.
131 */
Torsten Curdt46ad24d2009-01-08 11:09:25 +0000132 byte LF_CONTIG = (byte) '7';
Torsten Curdtca165392008-07-10 10:17:44 +0000133
134 /**
135 * The magic tag representing a POSIX tar archive.
136 */
Sebastian Bazley24f9c9b2009-04-02 15:19:17 +0000137 String MAGIC_POSIX = "ustar"; // TODO this should be NUL-terminated
Torsten Curdtca165392008-07-10 10:17:44 +0000138
139 /**
140 * The magic tag representing a GNU tar archive.
141 */
Sebastian Bazley24f9c9b2009-04-02 15:19:17 +0000142 String MAGIC_GNU = "ustar "; // TODO this should have single space terminator
Torsten Curdtca165392008-07-10 10:17:44 +0000143
144 /**
Sebastian Bazley24f9c9b2009-04-02 15:19:17 +0000145 * The name of the GNU tar entry which contains a long name.
Torsten Curdtca165392008-07-10 10:17:44 +0000146 */
Sebastian Bazley24f9c9b2009-04-02 15:19:17 +0000147 String GNU_LONGLINK = "././@LongLink"; // TODO rename as LONGLINK_GNU ?
Torsten Curdtca165392008-07-10 10:17:44 +0000148
149 /**
150 * Identifies the *next* file on the tape as having a long name.
151 */
Torsten Curdt46ad24d2009-01-08 11:09:25 +0000152 byte LF_GNUTYPE_LONGNAME = (byte) 'L';
Torsten Curdtca165392008-07-10 10:17:44 +0000153}