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 * https://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.dump; 20 21 /** 22 * Various constants associated with dump archives. 23 */ 24 public final class DumpArchiveConstants { 25 26 /** 27 * Enumerates compression types. 28 */ 29 public enum COMPRESSION_TYPE { 30 31 /** 32 * Compression code is -1. 33 */ 34 UNKNOWN(-1), 35 36 /** 37 * Compression code is 0. 38 */ 39 ZLIB(0), 40 41 /** 42 * Compression code is 1. 43 */ 44 BZLIB(1), 45 46 /** 47 * Compression code is 2. 48 */ 49 LZO(2); 50 51 /** 52 * Finds the matching enumeration value for the given code. 53 * 54 * @param code a code. 55 * @return a value, never null. 56 */ 57 public static COMPRESSION_TYPE find(final int code) { 58 for (final COMPRESSION_TYPE e : values()) { 59 if (e.code == code) { 60 return e; 61 } 62 } 63 return UNKNOWN; 64 } 65 66 final int code; 67 68 COMPRESSION_TYPE(final int code) { 69 this.code = code; 70 } 71 } 72 73 /** 74 * Enumerates the types of tape segment. 75 */ 76 public enum SEGMENT_TYPE { 77 78 /** 79 * TAPE with code 1. 80 */ 81 TAPE(1), 82 83 /** 84 * INODE with code 2. 85 */ 86 INODE(2), 87 88 /** 89 * BITS with code 3. 90 */ 91 BITS(3), 92 93 /** 94 * ADDR with code 4. 95 */ 96 ADDR(4), 97 98 /** 99 * END with code 5. 100 */ 101 END(5), 102 103 /** 104 * CLRI with code 6. 105 */ 106 CLRI(6); 107 108 /** 109 * Finds the matching enumeration value for the given code. 110 * 111 * @param code a code. 112 * @return a value, or null if not found. 113 */ 114 public static SEGMENT_TYPE find(final int code) { 115 for (final SEGMENT_TYPE e : values()) { 116 if (e.code == code) { 117 return e; 118 } 119 } 120 return null; 121 } 122 123 final int code; 124 125 SEGMENT_TYPE(final int code) { 126 this.code = code; 127 } 128 } 129 130 /** 131 * TP_SIZE value {@value}. 132 */ 133 public static final int TP_SIZE = 1024; 134 135 /** 136 * NTREC value {@value}. 137 */ 138 public static final int NTREC = 10; 139 140 /** 141 * HIGH_DENSITY_NTREC value {@value}. 142 */ 143 public static final int HIGH_DENSITY_NTREC = 32; 144 145 /** 146 * OFS_MAGIC value {@value}. 147 */ 148 public static final int OFS_MAGIC = 60011; 149 150 /** 151 * NFS_MAGIC value {@value}. 152 */ 153 public static final int NFS_MAGIC = 60012; 154 155 /** 156 * FS_UFS2_MAGIC value {@value}. 157 */ 158 public static final int FS_UFS2_MAGIC = 0x19540119; 159 160 /** 161 * CHECKSUM value {@value}. 162 */ 163 public static final int CHECKSUM = 84446; 164 165 /** 166 * LBLSIZE value {@value}. 167 */ 168 public static final int LBLSIZE = 16; 169 170 /** 171 * NAMELEN value {@value}. 172 */ 173 public static final int NAMELEN = 64; 174 175 /** Do not instantiate. */ 176 private DumpArchiveConstants() { 177 } 178 }