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