View Javadoc
1   /*
2    *  Licensed to the Apache Software Foundation (ASF) under one or more
3    *  contributor license agreements.  See the NOTICE file distributed with
4    *  this work for additional information regarding copyright ownership.
5    *  The ASF licenses this file to You under the Apache License, Version 2.0
6    *  (the "License"); you may not use this file except in compliance with
7    *  the License.  You may obtain a copy of the License at
8    *
9    *      http://www.apache.org/licenses/LICENSE-2.0
10   *
11   *  Unless required by applicable law or agreed to in writing, software
12   *  distributed under the License is distributed on an "AS IS" BASIS,
13   *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14   *  See the License for the specific language governing permissions and
15   *  limitations under the License.
16   */
17  package org.apache.commons.compress.archivers.arj;
18  
19  import java.util.Arrays;
20  
21  final class MainHeader {
22  
23      static final class Flags {
24          static final int GARBLED = 0x01;
25          static final int OLD_SECURED_NEW_ANSI_PAGE = 0x02;
26          static final int VOLUME = 0x04;
27          static final int ARJPROT = 0x08;
28          static final int PATHSYM = 0x10;
29          static final int BACKUP = 0x20;
30          static final int SECURED = 0x40;
31          static final int ALTNAME = 0x80;
32      }
33  
34      static final class HostOS {
35          static final int MS_DOS = 0;
36          static final int PRIMOS = 1;
37          static final int UNIX = 2;
38          static final int AMIGA = 3;
39          static final int MAC_OS = 4;
40          static final int OS2 = 5;
41          static final int APPLE_GS = 6;
42          static final int ATARI_ST = 7;
43          static final int NeXT = 8;
44          static final int VAX_VMS = 9;
45          static final int WIN95 = 10;
46          static final int WIN32 = 11;
47      }
48  
49      int archiverVersionNumber;
50      int minVersionToExtract;
51      int hostOS;
52      int arjFlags;
53      int securityVersion;
54      int fileType;
55      int reserved;
56      int dateTimeCreated;
57      int dateTimeModified;
58      long archiveSize;
59      int securityEnvelopeFilePosition;
60      int fileSpecPosition;
61      int securityEnvelopeLength;
62      int encryptionVersion;
63      int lastChapter;
64      int arjProtectionFactor;
65      int arjFlags2;
66      String name;
67      String comment;
68      byte[] extendedHeaderBytes;
69  
70      @Override
71      public String toString() {
72          final StringBuilder builder = new StringBuilder();
73          builder.append("MainHeader [archiverVersionNumber=");
74          builder.append(archiverVersionNumber);
75          builder.append(", minVersionToExtract=");
76          builder.append(minVersionToExtract);
77          builder.append(", hostOS=");
78          builder.append(hostOS);
79          builder.append(", arjFlags=");
80          builder.append(arjFlags);
81          builder.append(", securityVersion=");
82          builder.append(securityVersion);
83          builder.append(", fileType=");
84          builder.append(fileType);
85          builder.append(", reserved=");
86          builder.append(reserved);
87          builder.append(", dateTimeCreated=");
88          builder.append(dateTimeCreated);
89          builder.append(", dateTimeModified=");
90          builder.append(dateTimeModified);
91          builder.append(", archiveSize=");
92          builder.append(archiveSize);
93          builder.append(", securityEnvelopeFilePosition=");
94          builder.append(securityEnvelopeFilePosition);
95          builder.append(", fileSpecPosition=");
96          builder.append(fileSpecPosition);
97          builder.append(", securityEnvelopeLength=");
98          builder.append(securityEnvelopeLength);
99          builder.append(", encryptionVersion=");
100         builder.append(encryptionVersion);
101         builder.append(", lastChapter=");
102         builder.append(lastChapter);
103         builder.append(", arjProtectionFactor=");
104         builder.append(arjProtectionFactor);
105         builder.append(", arjFlags2=");
106         builder.append(arjFlags2);
107         builder.append(", name=");
108         builder.append(name);
109         builder.append(", comment=");
110         builder.append(comment);
111         builder.append(", extendedHeaderBytes=");
112         builder.append(Arrays.toString(extendedHeaderBytes));
113         builder.append("]");
114         return builder.toString();
115     }
116 }