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