• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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  */
18 package org.apache.commons.compress.archivers.arj;
19 
20 import java.util.Arrays;
21 
22 class MainHeader {
23     int archiverVersionNumber;
24     int minVersionToExtract;
25     int hostOS;
26     int arjFlags;
27     int securityVersion;
28     int fileType;
29     int reserved;
30     int dateTimeCreated;
31     int dateTimeModified;
32     long archiveSize;
33     int securityEnvelopeFilePosition;
34     int fileSpecPosition;
35     int securityEnvelopeLength;
36     int encryptionVersion;
37     int lastChapter;
38     int arjProtectionFactor;
39     int arjFlags2;
40     String name;
41     String comment;
42     byte[] extendedHeaderBytes = null;
43 
44     static class Flags {
45         static final int GARBLED = 0x01;
46         static final int OLD_SECURED_NEW_ANSI_PAGE = 0x02;
47         static final int VOLUME = 0x04;
48         static final int ARJPROT = 0x08;
49         static final int PATHSYM = 0x10;
50         static final int BACKUP = 0x20;
51         static final int SECURED = 0x40;
52         static final int ALTNAME = 0x80;
53     }
54 
55 
56     @Override
toString()57     public String toString() {
58         final StringBuilder builder = new StringBuilder();
59         builder.append("MainHeader [archiverVersionNumber=");
60         builder.append(archiverVersionNumber);
61         builder.append(", minVersionToExtract=");
62         builder.append(minVersionToExtract);
63         builder.append(", hostOS=");
64         builder.append(hostOS);
65         builder.append(", arjFlags=");
66         builder.append(arjFlags);
67         builder.append(", securityVersion=");
68         builder.append(securityVersion);
69         builder.append(", fileType=");
70         builder.append(fileType);
71         builder.append(", reserved=");
72         builder.append(reserved);
73         builder.append(", dateTimeCreated=");
74         builder.append(dateTimeCreated);
75         builder.append(", dateTimeModified=");
76         builder.append(dateTimeModified);
77         builder.append(", archiveSize=");
78         builder.append(archiveSize);
79         builder.append(", securityEnvelopeFilePosition=");
80         builder.append(securityEnvelopeFilePosition);
81         builder.append(", fileSpecPosition=");
82         builder.append(fileSpecPosition);
83         builder.append(", securityEnvelopeLength=");
84         builder.append(securityEnvelopeLength);
85         builder.append(", encryptionVersion=");
86         builder.append(encryptionVersion);
87         builder.append(", lastChapter=");
88         builder.append(lastChapter);
89         builder.append(", arjProtectionFactor=");
90         builder.append(arjProtectionFactor);
91         builder.append(", arjFlags2=");
92         builder.append(arjFlags2);
93         builder.append(", name=");
94         builder.append(name);
95         builder.append(", comment=");
96         builder.append(comment);
97         builder.append(", extendedHeaderBytes=");
98         builder.append(Arrays.toString(extendedHeaderBytes));
99         builder.append("]");
100         return builder.toString();
101     }
102 }
103