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