View Javadoc
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   *   https://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.arj;
20  
21  import java.util.Arrays;
22  
23  final class MainHeader {
24  
25      static final class Flags {
26          static final int GARBLED = 0x01;
27          static final int OLD_SECURED_NEW_ANSI_PAGE = 0x02;
28          static final int VOLUME = 0x04;
29          static final int ARJPROT = 0x08;
30          static final int PATHSYM = 0x10;
31          static final int BACKUP = 0x20;
32          static final int SECURED = 0x40;
33          static final int ALTNAME = 0x80;
34      }
35  
36      static final class HostOS {
37          static final int MS_DOS = 0;
38          static final int PRIMOS = 1;
39          static final int UNIX = 2;
40          static final int AMIGA = 3;
41          static final int MAC_OS = 4;
42          static final int OS2 = 5;
43          static final int APPLE_GS = 6;
44          static final int ATARI_ST = 7;
45          static final int NeXT = 8;
46          static final int VAX_VMS = 9;
47          static final int WIN95 = 10;
48          static final int WIN32 = 11;
49      }
50  
51      int archiverVersionNumber;
52      int minVersionToExtract;
53      int hostOS;
54      int arjFlags;
55      int securityVersion;
56      int fileType;
57      int reserved;
58      int dateTimeCreated;
59      int dateTimeModified;
60      long archiveSize;
61      int securityEnvelopeFilePosition;
62      int fileSpecPosition;
63      int securityEnvelopeLength;
64      int encryptionVersion;
65      int lastChapter;
66      int arjProtectionFactor;
67      int arjFlags2;
68      String name;
69      String comment;
70      byte[] extendedHeaderBytes;
71  
72      @Override
73      public String toString() {
74          final StringBuilder builder = new StringBuilder();
75          builder.append("MainHeader [archiverVersionNumber=");
76          builder.append(archiverVersionNumber);
77          builder.append(", minVersionToExtract=");
78          builder.append(minVersionToExtract);
79          builder.append(", hostOS=");
80          builder.append(hostOS);
81          builder.append(", arjFlags=");
82          builder.append(arjFlags);
83          builder.append(", securityVersion=");
84          builder.append(securityVersion);
85          builder.append(", fileType=");
86          builder.append(fileType);
87          builder.append(", reserved=");
88          builder.append(reserved);
89          builder.append(", dateTimeCreated=");
90          builder.append(dateTimeCreated);
91          builder.append(", dateTimeModified=");
92          builder.append(dateTimeModified);
93          builder.append(", archiveSize=");
94          builder.append(archiveSize);
95          builder.append(", securityEnvelopeFilePosition=");
96          builder.append(securityEnvelopeFilePosition);
97          builder.append(", fileSpecPosition=");
98          builder.append(fileSpecPosition);
99          builder.append(", securityEnvelopeLength=");
100         builder.append(securityEnvelopeLength);
101         builder.append(", encryptionVersion=");
102         builder.append(encryptionVersion);
103         builder.append(", lastChapter=");
104         builder.append(lastChapter);
105         builder.append(", arjProtectionFactor=");
106         builder.append(arjProtectionFactor);
107         builder.append(", arjFlags2=");
108         builder.append(arjFlags2);
109         builder.append(", name=");
110         builder.append(name);
111         builder.append(", comment=");
112         builder.append(comment);
113         builder.append(", extendedHeaderBytes=");
114         builder.append(Arrays.toString(extendedHeaderBytes));
115         builder.append("]");
116         return builder.toString();
117     }
118 }