DumpArchiveConstants.java

  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.  * Various constants associated with dump archives.
  22.  */
  23. public final class DumpArchiveConstants {
  24.     /**
  25.      * The type of compression.
  26.      */
  27.     public enum COMPRESSION_TYPE {
  28.         UNKNOWN(-1), ZLIB(0), BZLIB(1), LZO(2);

  29.         public static COMPRESSION_TYPE find(final int code) {
  30.             for (final COMPRESSION_TYPE t : values()) {
  31.                 if (t.code == code) {
  32.                     return t;
  33.                 }
  34.             }

  35.             return UNKNOWN;
  36.         }

  37.         final int code;

  38.         COMPRESSION_TYPE(final int code) {
  39.             this.code = code;
  40.         }
  41.     }

  42.     /**
  43.      * The type of tape segment.
  44.      */
  45.     public enum SEGMENT_TYPE {
  46.         TAPE(1), INODE(2), BITS(3), ADDR(4), END(5), CLRI(6);

  47.         public static SEGMENT_TYPE find(final int code) {
  48.             for (final SEGMENT_TYPE t : values()) {
  49.                 if (t.code == code) {
  50.                     return t;
  51.                 }
  52.             }

  53.             return null;
  54.         }

  55.         final int code;

  56.         SEGMENT_TYPE(final int code) {
  57.             this.code = code;
  58.         }
  59.     }

  60.     public static final int TP_SIZE = 1024;
  61.     public static final int NTREC = 10;
  62.     public static final int HIGH_DENSITY_NTREC = 32;
  63.     public static final int OFS_MAGIC = 60011;
  64.     public static final int NFS_MAGIC = 60012;
  65.     public static final int FS_UFS2_MAGIC = 0x19540119;
  66.     public static final int CHECKSUM = 84446;

  67.     public static final int LBLSIZE = 16;

  68.     public static final int NAMELEN = 64;

  69.     /* do not instantiate */
  70.     private DumpArchiveConstants() {
  71.     }
  72. }