001/* 002 * Licensed to the Apache Software Foundation (ASF) under one 003 * or more contributor license agreements. See the NOTICE file 004 * distributed with this work for additional information 005 * regarding copyright ownership. The ASF licenses this file 006 * to you under the Apache License, Version 2.0 (the 007 * "License"); you may not use this file except in compliance 008 * with the License. You may obtain a copy of the License at 009 * 010 * http://www.apache.org/licenses/LICENSE-2.0 011 * 012 * Unless required by applicable law or agreed to in writing, 013 * software distributed under the License is distributed on an 014 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 015 * KIND, either express or implied. See the License for the 016 * specific language governing permissions and limitations 017 * under the License. 018 */ 019package org.apache.commons.compress.archivers.cpio; 020 021/** 022 * All constants needed by CPIO. 023 * 024 * based on code from the jRPM project (jrpm.sourceforge.net) 025 * 026 * http://www.opengroup.org/onlinepubs/9699919799/basedefs/cpio.h.html has a list of the C_xxx constants. 027 * 028 */ 029public interface CpioConstants { 030 /** magic number of a cpio entry in the new format */ 031 String MAGIC_NEW = "070701"; 032 033 /** magic number of a cpio entry in the new format with crc */ 034 String MAGIC_NEW_CRC = "070702"; 035 036 /** magic number of a cpio entry in the old ascii format */ 037 String MAGIC_OLD_ASCII = "070707"; 038 039 /** magic number of a cpio entry in the old binary format */ 040 int MAGIC_OLD_BINARY = 070707; 041 042 /** write/read a CpioArchiveEntry in the new format. FORMAT_ constants are internal. */ 043 short FORMAT_NEW = 1; 044 045 /** write/read a CpioArchiveEntry in the new format with crc. FORMAT_ constants are internal. */ 046 short FORMAT_NEW_CRC = 2; 047 048 /** write/read a CpioArchiveEntry in the old ascii format. FORMAT_ constants are internal. */ 049 short FORMAT_OLD_ASCII = 4; 050 051 /** write/read a CpioArchiveEntry in the old binary format. FORMAT_ constants are internal. */ 052 short FORMAT_OLD_BINARY = 8; 053 054 /** Mask for both new formats. FORMAT_ constants are internal. */ 055 short FORMAT_NEW_MASK = 3; 056 057 /** Mask for both old formats. FORMAT_ constants are internal. */ 058 short FORMAT_OLD_MASK = 12; 059 060 /* 061 * Constants for the MODE bits 062 */ 063 064 /** Mask for all file type bits. */ 065 int S_IFMT = 0170000; 066 067 /** Defines a socket */ 068 int C_ISSOCK = 0140000; 069 070 /** Defines a symbolic link */ 071 int C_ISLNK = 0120000; 072 073 /** HP/UX network special (C_ISCTG) */ 074 int C_ISNWK = 0110000; 075 076 /** Defines a regular file */ 077 int C_ISREG = 0100000; 078 079 /** Defines a block device */ 080 int C_ISBLK = 0060000; 081 082 /** Defines a directory */ 083 int C_ISDIR = 0040000; 084 085 /** Defines a character device */ 086 int C_ISCHR = 0020000; 087 088 /** Defines a pipe */ 089 int C_ISFIFO = 0010000; 090 091 092 /** Set user ID */ 093 int C_ISUID = 0004000; 094 095 /** Set group ID */ 096 int C_ISGID = 0002000; 097 098 /** On directories, restricted deletion flag. */ 099 int C_ISVTX = 0001000; 100 101 102 /** Permits the owner of a file to read the file */ 103 int C_IRUSR = 0000400; 104 105 /** Permits the owner of a file to write to the file */ 106 int C_IWUSR = 0000200; 107 108 /** Permits the owner of a file to execute the file or to search the directory */ 109 int C_IXUSR = 0000100; 110 111 112 /** Permits a file's group to read the file */ 113 int C_IRGRP = 0000040; 114 115 /** Permits a file's group to write to the file */ 116 int C_IWGRP = 0000020; 117 118 /** Permits a file's group to execute the file or to search the directory */ 119 int C_IXGRP = 0000010; 120 121 122 /** Permits others to read the file */ 123 int C_IROTH = 0000004; 124 125 /** Permits others to write to the file */ 126 int C_IWOTH = 0000002; 127 128 /** Permits others to execute the file or to search the directory */ 129 int C_IXOTH = 0000001; 130 131 /** The special trailer marker */ 132 String CPIO_TRAILER = "TRAILER!!!"; 133 134 /** 135 * The default block size. 136 * 137 * @since 1.1 138 */ 139 int BLOCK_SIZE = 512; 140}