    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.dump;
    020
    021/**
    022 * Various constants associated with dump archives.
    023 */
    024public final class DumpArchiveConstants {
    025    /**
    026     * The type of compression.
    027     */
    028    public enum COMPRESSION_TYPE {
    029        ZLIB(0),
    030        BZLIB(1),
    031        LZO(2);
    032
    033        public static COMPRESSION_TYPE find(final int code) {
    034            for (final COMPRESSION_TYPE t : values()) {
    035                if (t.code == code) {
    036                    return t;
    037                }
    038            }
    039
    040            return null;
    041        }
    042
    043        final int code;
    044
    045        COMPRESSION_TYPE(final int code) {
    046            this.code = code;
    047        }
    048    }
    049    /**
    050     * The type of tape segment.
    051     */
    052    public enum SEGMENT_TYPE {
    053        TAPE(1),
    054        INODE(2),
    055        BITS(3),
    056        ADDR(4),
    057        END(5),
    058        CLRI(6);
    059
    060        public static SEGMENT_TYPE find(final int code) {
    061            for (final SEGMENT_TYPE t : values()) {
    062                if (t.code == code) {
    063                    return t;
    064                }
    065            }
    066
    067            return null;
    068        }
    069
    070        final int code;
    071
    072        SEGMENT_TYPE(final int code) {
    073            this.code = code;
    074        }
    075    }
    076    public static final int TP_SIZE = 1024;
    077    public static final int NTREC = 10;
    078    public static final int HIGH_DENSITY_NTREC = 32;
    079    public static final int OFS_MAGIC = 60011;
    080    public static final int NFS_MAGIC = 60012;
    081    public static final int FS_UFS2_MAGIC = 0x19540119;
    082    public static final int CHECKSUM = 84446;
    083
    084    public static final int LBLSIZE = 16;
    085
    086    public static final int NAMELEN = 64;
    087
    088    /* do not instantiate */
    089    private DumpArchiveConstants() {
    090    }
    091}