blob: 8abf3d3a9d3a5fbe7c13385450ec453ad4bbce58 [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
Sebastian Bazley8118f822009-04-02 23:34:48 +000063 /** Offset of start of magic field within header record */
64 int MAGIC_OFFSET = 257;
Torsten Curdtca165392008-07-10 10:17:44 +000065 /**
66 * The length of the magic field in a header buffer.
67 */
Sebastian Bazley8118f822009-04-02 23:34:48 +000068 int MAGICLEN = 6;
69
70 /** Offset of start of magic field within header record */
71 int VERSION_OFFSET = 263;
72 /**
73 * Previously this was regarded as part of "magic" field, but it is separate.
74 */
75 int VERSIONLEN = 2;
Torsten Curdtca165392008-07-10 10:17:44 +000076
77 /**
78 * The length of the modification time field in a header buffer.
79 */
Torsten Curdt46ad24d2009-01-08 11:09:25 +000080 int MODTIMELEN = 12;
Torsten Curdtca165392008-07-10 10:17:44 +000081
82 /**
83 * The length of the user name field in a header buffer.
84 */
Torsten Curdt46ad24d2009-01-08 11:09:25 +000085 int UNAMELEN = 32;
Torsten Curdtca165392008-07-10 10:17:44 +000086
87 /**
88 * The length of the group name field in a header buffer.
89 */
Torsten Curdt46ad24d2009-01-08 11:09:25 +000090 int GNAMELEN = 32;
Torsten Curdtca165392008-07-10 10:17:44 +000091
92 /**
Sebastian Bazley24f9c9b2009-04-02 15:19:17 +000093 * The length of each of the device fields (major and minor) in a header buffer.
Torsten Curdtca165392008-07-10 10:17:44 +000094 */
Torsten Curdt46ad24d2009-01-08 11:09:25 +000095 int DEVLEN = 8;
Torsten Curdtca165392008-07-10 10:17:44 +000096
97 /**
Sebastian Bazley8118f822009-04-02 23:34:48 +000098 * Length of the prefix field.
99 *
100 */
101 int PREFIXLEN = 155;
102
103 /**
Torsten Curdtca165392008-07-10 10:17:44 +0000104 * LF_ constants represent the "link flag" of an entry, or more commonly,
105 * the "entry type". This is the "old way" of indicating a normal file.
106 */
Torsten Curdt46ad24d2009-01-08 11:09:25 +0000107 byte LF_OLDNORM = 0;
Torsten Curdtca165392008-07-10 10:17:44 +0000108
109 /**
110 * Normal file type.
111 */
Torsten Curdt46ad24d2009-01-08 11:09:25 +0000112 byte LF_NORMAL = (byte) '0';
Torsten Curdtca165392008-07-10 10:17:44 +0000113
114 /**
115 * Link file type.
116 */
Torsten Curdt46ad24d2009-01-08 11:09:25 +0000117 byte LF_LINK = (byte) '1';
Torsten Curdtca165392008-07-10 10:17:44 +0000118
119 /**
120 * Symbolic link file type.
121 */
Torsten Curdt46ad24d2009-01-08 11:09:25 +0000122 byte LF_SYMLINK = (byte) '2';
Torsten Curdtca165392008-07-10 10:17:44 +0000123
124 /**
125 * Character device file type.
126 */
Torsten Curdt46ad24d2009-01-08 11:09:25 +0000127 byte LF_CHR = (byte) '3';
Torsten Curdtca165392008-07-10 10:17:44 +0000128
129 /**
130 * Block device file type.
131 */
Torsten Curdt46ad24d2009-01-08 11:09:25 +0000132 byte LF_BLK = (byte) '4';
Torsten Curdtca165392008-07-10 10:17:44 +0000133
134 /**
135 * Directory file type.
136 */
Torsten Curdt46ad24d2009-01-08 11:09:25 +0000137 byte LF_DIR = (byte) '5';
Torsten Curdtca165392008-07-10 10:17:44 +0000138
139 /**
140 * FIFO (pipe) file type.
141 */
Torsten Curdt46ad24d2009-01-08 11:09:25 +0000142 byte LF_FIFO = (byte) '6';
Torsten Curdtca165392008-07-10 10:17:44 +0000143
144 /**
145 * Contiguous file type.
146 */
Torsten Curdt46ad24d2009-01-08 11:09:25 +0000147 byte LF_CONTIG = (byte) '7';
Torsten Curdtca165392008-07-10 10:17:44 +0000148
149 /**
150 * The magic tag representing a POSIX tar archive.
151 */
Sebastian Bazley8118f822009-04-02 23:34:48 +0000152 String MAGIC_POSIX = "ustar\0";
153 String VERSION_POSIX = "00";
Torsten Curdtca165392008-07-10 10:17:44 +0000154
155 /**
156 * The magic tag representing a GNU tar archive.
157 */
Sebastian Bazley8118f822009-04-02 23:34:48 +0000158 String MAGIC_GNU = "ustar ";
159 // Appear to be two possible GNU versions
160 String VERSION_GNU_SPACE = " \0";
161 String VERSION_GNU_ZERO = "0\0";
Torsten Curdtca165392008-07-10 10:17:44 +0000162
163 /**
Sebastian Bazley24f9c9b2009-04-02 15:19:17 +0000164 * The name of the GNU tar entry which contains a long name.
Torsten Curdtca165392008-07-10 10:17:44 +0000165 */
Sebastian Bazley24f9c9b2009-04-02 15:19:17 +0000166 String GNU_LONGLINK = "././@LongLink"; // TODO rename as LONGLINK_GNU ?
Torsten Curdtca165392008-07-10 10:17:44 +0000167
168 /**
169 * Identifies the *next* file on the tape as having a long name.
170 */
Torsten Curdt46ad24d2009-01-08 11:09:25 +0000171 byte LF_GNUTYPE_LONGNAME = (byte) 'L';
Torsten Curdtca165392008-07-10 10:17:44 +0000172}