View Javadoc
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.dump;
20  
21  /**
22   * Various constants associated with dump archives.
23   */
24  public final class DumpArchiveConstants {
25      /**
26       * The type of compression.
27       */
28      public enum COMPRESSION_TYPE {
29          UNKNOWN(-1), ZLIB(0), BZLIB(1), LZO(2);
30  
31          public static COMPRESSION_TYPE find(final int code) {
32              for (final COMPRESSION_TYPE t : values()) {
33                  if (t.code == code) {
34                      return t;
35                  }
36              }
37  
38              return UNKNOWN;
39          }
40  
41          final int code;
42  
43          COMPRESSION_TYPE(final int code) {
44              this.code = code;
45          }
46      }
47  
48      /**
49       * The type of tape segment.
50       */
51      public enum SEGMENT_TYPE {
52          TAPE(1), INODE(2), BITS(3), ADDR(4), END(5), CLRI(6);
53  
54          public static SEGMENT_TYPE find(final int code) {
55              for (final SEGMENT_TYPE t : values()) {
56                  if (t.code == code) {
57                      return t;
58                  }
59              }
60  
61              return null;
62          }
63  
64          final int code;
65  
66          SEGMENT_TYPE(final int code) {
67              this.code = code;
68          }
69      }
70  
71      public static final int TP_SIZE = 1024;
72      public static final int NTREC = 10;
73      public static final int HIGH_DENSITY_NTREC = 32;
74      public static final int OFS_MAGIC = 60011;
75      public static final int NFS_MAGIC = 60012;
76      public static final int FS_UFS2_MAGIC = 0x19540119;
77      public static final int CHECKSUM = 84446;
78  
79      public static final int LBLSIZE = 16;
80  
81      public static final int NAMELEN = 64;
82  
83      /* do not instantiate */
84      private DumpArchiveConstants() {
85      }
86  }