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 | |
| 63 | /** |
| 64 | * The length of the magic field in a header buffer. |
| 65 | */ |
Sebastian Bazley | 24f9c9b | 2009-04-02 15:19:17 +0000 | [diff] [blame^] | 66 | int MAGICLEN = 8; // TODO split this into MAGICLEN=6 and VERSIONLEN=2 |
Torsten Curdt | ca16539 | 2008-07-10 10:17:44 +0000 | [diff] [blame] | 67 | |
| 68 | /** |
| 69 | * The length of the modification time field in a header buffer. |
| 70 | */ |
Torsten Curdt | 46ad24d | 2009-01-08 11:09:25 +0000 | [diff] [blame] | 71 | int MODTIMELEN = 12; |
Torsten Curdt | ca16539 | 2008-07-10 10:17:44 +0000 | [diff] [blame] | 72 | |
| 73 | /** |
| 74 | * The length of the user name field in a header buffer. |
| 75 | */ |
Torsten Curdt | 46ad24d | 2009-01-08 11:09:25 +0000 | [diff] [blame] | 76 | int UNAMELEN = 32; |
Torsten Curdt | ca16539 | 2008-07-10 10:17:44 +0000 | [diff] [blame] | 77 | |
| 78 | /** |
| 79 | * The length of the group name field in a header buffer. |
| 80 | */ |
Torsten Curdt | 46ad24d | 2009-01-08 11:09:25 +0000 | [diff] [blame] | 81 | int GNAMELEN = 32; |
Torsten Curdt | ca16539 | 2008-07-10 10:17:44 +0000 | [diff] [blame] | 82 | |
| 83 | /** |
Sebastian Bazley | 24f9c9b | 2009-04-02 15:19:17 +0000 | [diff] [blame^] | 84 | * 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] | 85 | */ |
Torsten Curdt | 46ad24d | 2009-01-08 11:09:25 +0000 | [diff] [blame] | 86 | int DEVLEN = 8; |
Torsten Curdt | ca16539 | 2008-07-10 10:17:44 +0000 | [diff] [blame] | 87 | |
| 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 Curdt | 46ad24d | 2009-01-08 11:09:25 +0000 | [diff] [blame] | 92 | byte LF_OLDNORM = 0; |
Torsten Curdt | ca16539 | 2008-07-10 10:17:44 +0000 | [diff] [blame] | 93 | |
| 94 | /** |
| 95 | * Normal file type. |
| 96 | */ |
Torsten Curdt | 46ad24d | 2009-01-08 11:09:25 +0000 | [diff] [blame] | 97 | byte LF_NORMAL = (byte) '0'; |
Torsten Curdt | ca16539 | 2008-07-10 10:17:44 +0000 | [diff] [blame] | 98 | |
| 99 | /** |
| 100 | * Link file type. |
| 101 | */ |
Torsten Curdt | 46ad24d | 2009-01-08 11:09:25 +0000 | [diff] [blame] | 102 | byte LF_LINK = (byte) '1'; |
Torsten Curdt | ca16539 | 2008-07-10 10:17:44 +0000 | [diff] [blame] | 103 | |
| 104 | /** |
| 105 | * Symbolic link file type. |
| 106 | */ |
Torsten Curdt | 46ad24d | 2009-01-08 11:09:25 +0000 | [diff] [blame] | 107 | byte LF_SYMLINK = (byte) '2'; |
Torsten Curdt | ca16539 | 2008-07-10 10:17:44 +0000 | [diff] [blame] | 108 | |
| 109 | /** |
| 110 | * Character device file type. |
| 111 | */ |
Torsten Curdt | 46ad24d | 2009-01-08 11:09:25 +0000 | [diff] [blame] | 112 | byte LF_CHR = (byte) '3'; |
Torsten Curdt | ca16539 | 2008-07-10 10:17:44 +0000 | [diff] [blame] | 113 | |
| 114 | /** |
| 115 | * Block device file type. |
| 116 | */ |
Torsten Curdt | 46ad24d | 2009-01-08 11:09:25 +0000 | [diff] [blame] | 117 | byte LF_BLK = (byte) '4'; |
Torsten Curdt | ca16539 | 2008-07-10 10:17:44 +0000 | [diff] [blame] | 118 | |
| 119 | /** |
| 120 | * Directory file type. |
| 121 | */ |
Torsten Curdt | 46ad24d | 2009-01-08 11:09:25 +0000 | [diff] [blame] | 122 | byte LF_DIR = (byte) '5'; |
Torsten Curdt | ca16539 | 2008-07-10 10:17:44 +0000 | [diff] [blame] | 123 | |
| 124 | /** |
| 125 | * FIFO (pipe) file type. |
| 126 | */ |
Torsten Curdt | 46ad24d | 2009-01-08 11:09:25 +0000 | [diff] [blame] | 127 | byte LF_FIFO = (byte) '6'; |
Torsten Curdt | ca16539 | 2008-07-10 10:17:44 +0000 | [diff] [blame] | 128 | |
| 129 | /** |
| 130 | * Contiguous file type. |
| 131 | */ |
Torsten Curdt | 46ad24d | 2009-01-08 11:09:25 +0000 | [diff] [blame] | 132 | byte LF_CONTIG = (byte) '7'; |
Torsten Curdt | ca16539 | 2008-07-10 10:17:44 +0000 | [diff] [blame] | 133 | |
| 134 | /** |
| 135 | * The magic tag representing a POSIX tar archive. |
| 136 | */ |
Sebastian Bazley | 24f9c9b | 2009-04-02 15:19:17 +0000 | [diff] [blame^] | 137 | String MAGIC_POSIX = "ustar"; // TODO this should be NUL-terminated |
Torsten Curdt | ca16539 | 2008-07-10 10:17:44 +0000 | [diff] [blame] | 138 | |
| 139 | /** |
| 140 | * The magic tag representing a GNU tar archive. |
| 141 | */ |
Sebastian Bazley | 24f9c9b | 2009-04-02 15:19:17 +0000 | [diff] [blame^] | 142 | String MAGIC_GNU = "ustar "; // TODO this should have single space terminator |
Torsten Curdt | ca16539 | 2008-07-10 10:17:44 +0000 | [diff] [blame] | 143 | |
| 144 | /** |
Sebastian Bazley | 24f9c9b | 2009-04-02 15:19:17 +0000 | [diff] [blame^] | 145 | * The name of the GNU tar entry which contains a long name. |
Torsten Curdt | ca16539 | 2008-07-10 10:17:44 +0000 | [diff] [blame] | 146 | */ |
Sebastian Bazley | 24f9c9b | 2009-04-02 15:19:17 +0000 | [diff] [blame^] | 147 | String GNU_LONGLINK = "././@LongLink"; // TODO rename as LONGLINK_GNU ? |
Torsten Curdt | ca16539 | 2008-07-10 10:17:44 +0000 | [diff] [blame] | 148 | |
| 149 | /** |
| 150 | * Identifies the *next* file on the tape as having a long name. |
| 151 | */ |
Torsten Curdt | 46ad24d | 2009-01-08 11:09:25 +0000 | [diff] [blame] | 152 | byte LF_GNUTYPE_LONGNAME = (byte) 'L'; |
Torsten Curdt | ca16539 | 2008-07-10 10:17:44 +0000 | [diff] [blame] | 153 | } |