Torsten Curdt | ca16539 | 2008-07-10 10:17:44 +0000 | [diff] [blame] | 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 | * 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 | */ |
| 19 | package org.apache.commons.compress.archivers.tar; |
| 20 | |
| 21 | /** |
| 22 | * This interface contains all the definitions used in the package. |
Torsten Curdt | 46ad24d | 2009-01-08 11:09:25 +0000 | [diff] [blame] | 23 | * |
Torsten Curdt | ca16539 | 2008-07-10 10:17:44 +0000 | [diff] [blame] | 24 | */ |
Torsten Curdt | 46ad24d | 2009-01-08 11:09:25 +0000 | [diff] [blame] | 25 | // CheckStyle:InterfaceIsTypeCheck OFF (bc) |
| 26 | public interface TarConstants { |
| 27 | |
| 28 | /** |
| 29 | * The length of the name field in a header buffer. |
| 30 | */ |
| 31 | int NAMELEN = 100; |
| 32 | |
Torsten Curdt | ca16539 | 2008-07-10 10:17:44 +0000 | [diff] [blame] | 33 | /** |
| 34 | * The length of the mode field in a header buffer. |
| 35 | */ |
Torsten Curdt | 46ad24d | 2009-01-08 11:09:25 +0000 | [diff] [blame] | 36 | int MODELEN = 8; |
Torsten Curdt | ca16539 | 2008-07-10 10:17:44 +0000 | [diff] [blame] | 37 | |
| 38 | /** |
| 39 | * The length of the user id field in a header buffer. |
| 40 | */ |
Torsten Curdt | 46ad24d | 2009-01-08 11:09:25 +0000 | [diff] [blame] | 41 | int UIDLEN = 8; |
Torsten Curdt | ca16539 | 2008-07-10 10:17:44 +0000 | [diff] [blame] | 42 | |
| 43 | /** |
| 44 | * The length of the group id field in a header buffer. |
| 45 | */ |
Torsten Curdt | 46ad24d | 2009-01-08 11:09:25 +0000 | [diff] [blame] | 46 | int GIDLEN = 8; |
Torsten Curdt | ca16539 | 2008-07-10 10:17:44 +0000 | [diff] [blame] | 47 | |
| 48 | /** |
| 49 | * The length of the checksum field in a header buffer. |
| 50 | */ |
Torsten Curdt | 46ad24d | 2009-01-08 11:09:25 +0000 | [diff] [blame] | 51 | int CHKSUMLEN = 8; |
Torsten Curdt | ca16539 | 2008-07-10 10:17:44 +0000 | [diff] [blame] | 52 | |
| 53 | /** |
| 54 | * The length of the size field in a header buffer. |
| 55 | */ |
Torsten Curdt | 46ad24d | 2009-01-08 11:09:25 +0000 | [diff] [blame] | 56 | 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 Curdt | ca16539 | 2008-07-10 10:17:44 +0000 | [diff] [blame] | 62 | |
Sebastian Bazley | 8118f82 | 2009-04-02 23:34:48 +0000 | [diff] [blame^] | 63 | /** Offset of start of magic field within header record */ |
| 64 | int MAGIC_OFFSET = 257; |
Torsten Curdt | ca16539 | 2008-07-10 10:17:44 +0000 | [diff] [blame] | 65 | /** |
| 66 | * The length of the magic field in a header buffer. |
| 67 | */ |
Sebastian Bazley | 8118f82 | 2009-04-02 23:34:48 +0000 | [diff] [blame^] | 68 | 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 Curdt | ca16539 | 2008-07-10 10:17:44 +0000 | [diff] [blame] | 76 | |
| 77 | /** |
| 78 | * The length of the modification time field in a header buffer. |
| 79 | */ |
Torsten Curdt | 46ad24d | 2009-01-08 11:09:25 +0000 | [diff] [blame] | 80 | int MODTIMELEN = 12; |
Torsten Curdt | ca16539 | 2008-07-10 10:17:44 +0000 | [diff] [blame] | 81 | |
| 82 | /** |
| 83 | * The length of the user name field in a header buffer. |
| 84 | */ |
Torsten Curdt | 46ad24d | 2009-01-08 11:09:25 +0000 | [diff] [blame] | 85 | int UNAMELEN = 32; |
Torsten Curdt | ca16539 | 2008-07-10 10:17:44 +0000 | [diff] [blame] | 86 | |
| 87 | /** |
| 88 | * The length of the group name field in a header buffer. |
| 89 | */ |
Torsten Curdt | 46ad24d | 2009-01-08 11:09:25 +0000 | [diff] [blame] | 90 | int GNAMELEN = 32; |
Torsten Curdt | ca16539 | 2008-07-10 10:17:44 +0000 | [diff] [blame] | 91 | |
| 92 | /** |
Sebastian Bazley | 24f9c9b | 2009-04-02 15:19:17 +0000 | [diff] [blame] | 93 | * The length of each of the device fields (major and minor) in a header buffer. |
Torsten Curdt | ca16539 | 2008-07-10 10:17:44 +0000 | [diff] [blame] | 94 | */ |
Torsten Curdt | 46ad24d | 2009-01-08 11:09:25 +0000 | [diff] [blame] | 95 | int DEVLEN = 8; |
Torsten Curdt | ca16539 | 2008-07-10 10:17:44 +0000 | [diff] [blame] | 96 | |
| 97 | /** |
Sebastian Bazley | 8118f82 | 2009-04-02 23:34:48 +0000 | [diff] [blame^] | 98 | * Length of the prefix field. |
| 99 | * |
| 100 | */ |
| 101 | int PREFIXLEN = 155; |
| 102 | |
| 103 | /** |
Torsten Curdt | ca16539 | 2008-07-10 10:17:44 +0000 | [diff] [blame] | 104 | * 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 Curdt | 46ad24d | 2009-01-08 11:09:25 +0000 | [diff] [blame] | 107 | byte LF_OLDNORM = 0; |
Torsten Curdt | ca16539 | 2008-07-10 10:17:44 +0000 | [diff] [blame] | 108 | |
| 109 | /** |
| 110 | * Normal file type. |
| 111 | */ |
Torsten Curdt | 46ad24d | 2009-01-08 11:09:25 +0000 | [diff] [blame] | 112 | byte LF_NORMAL = (byte) '0'; |
Torsten Curdt | ca16539 | 2008-07-10 10:17:44 +0000 | [diff] [blame] | 113 | |
| 114 | /** |
| 115 | * Link file type. |
| 116 | */ |
Torsten Curdt | 46ad24d | 2009-01-08 11:09:25 +0000 | [diff] [blame] | 117 | byte LF_LINK = (byte) '1'; |
Torsten Curdt | ca16539 | 2008-07-10 10:17:44 +0000 | [diff] [blame] | 118 | |
| 119 | /** |
| 120 | * Symbolic link file type. |
| 121 | */ |
Torsten Curdt | 46ad24d | 2009-01-08 11:09:25 +0000 | [diff] [blame] | 122 | byte LF_SYMLINK = (byte) '2'; |
Torsten Curdt | ca16539 | 2008-07-10 10:17:44 +0000 | [diff] [blame] | 123 | |
| 124 | /** |
| 125 | * Character device file type. |
| 126 | */ |
Torsten Curdt | 46ad24d | 2009-01-08 11:09:25 +0000 | [diff] [blame] | 127 | byte LF_CHR = (byte) '3'; |
Torsten Curdt | ca16539 | 2008-07-10 10:17:44 +0000 | [diff] [blame] | 128 | |
| 129 | /** |
| 130 | * Block device file type. |
| 131 | */ |
Torsten Curdt | 46ad24d | 2009-01-08 11:09:25 +0000 | [diff] [blame] | 132 | byte LF_BLK = (byte) '4'; |
Torsten Curdt | ca16539 | 2008-07-10 10:17:44 +0000 | [diff] [blame] | 133 | |
| 134 | /** |
| 135 | * Directory file type. |
| 136 | */ |
Torsten Curdt | 46ad24d | 2009-01-08 11:09:25 +0000 | [diff] [blame] | 137 | byte LF_DIR = (byte) '5'; |
Torsten Curdt | ca16539 | 2008-07-10 10:17:44 +0000 | [diff] [blame] | 138 | |
| 139 | /** |
| 140 | * FIFO (pipe) file type. |
| 141 | */ |
Torsten Curdt | 46ad24d | 2009-01-08 11:09:25 +0000 | [diff] [blame] | 142 | byte LF_FIFO = (byte) '6'; |
Torsten Curdt | ca16539 | 2008-07-10 10:17:44 +0000 | [diff] [blame] | 143 | |
| 144 | /** |
| 145 | * Contiguous file type. |
| 146 | */ |
Torsten Curdt | 46ad24d | 2009-01-08 11:09:25 +0000 | [diff] [blame] | 147 | byte LF_CONTIG = (byte) '7'; |
Torsten Curdt | ca16539 | 2008-07-10 10:17:44 +0000 | [diff] [blame] | 148 | |
| 149 | /** |
| 150 | * The magic tag representing a POSIX tar archive. |
| 151 | */ |
Sebastian Bazley | 8118f82 | 2009-04-02 23:34:48 +0000 | [diff] [blame^] | 152 | String MAGIC_POSIX = "ustar\0"; |
| 153 | String VERSION_POSIX = "00"; |
Torsten Curdt | ca16539 | 2008-07-10 10:17:44 +0000 | [diff] [blame] | 154 | |
| 155 | /** |
| 156 | * The magic tag representing a GNU tar archive. |
| 157 | */ |
Sebastian Bazley | 8118f82 | 2009-04-02 23:34:48 +0000 | [diff] [blame^] | 158 | 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 Curdt | ca16539 | 2008-07-10 10:17:44 +0000 | [diff] [blame] | 162 | |
| 163 | /** |
Sebastian Bazley | 24f9c9b | 2009-04-02 15:19:17 +0000 | [diff] [blame] | 164 | * The name of the GNU tar entry which contains a long name. |
Torsten Curdt | ca16539 | 2008-07-10 10:17:44 +0000 | [diff] [blame] | 165 | */ |
Sebastian Bazley | 24f9c9b | 2009-04-02 15:19:17 +0000 | [diff] [blame] | 166 | String GNU_LONGLINK = "././@LongLink"; // TODO rename as LONGLINK_GNU ? |
Torsten Curdt | ca16539 | 2008-07-10 10:17:44 +0000 | [diff] [blame] | 167 | |
| 168 | /** |
| 169 | * Identifies the *next* file on the tape as having a long name. |
| 170 | */ |
Torsten Curdt | 46ad24d | 2009-01-08 11:09:25 +0000 | [diff] [blame] | 171 | byte LF_GNUTYPE_LONGNAME = (byte) 'L'; |
Torsten Curdt | ca16539 | 2008-07-10 10:17:44 +0000 | [diff] [blame] | 172 | } |