blob: 2f42327cfaf2171d4e2f051b2c5e04bb9ffe2276 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
|
/*
* Copyright (c) 2007 innoSysTec (R) GmbH, Germany. All rights reserved.
* Original author: Edmund Wagner
* Creation date: 22.05.2007
*
* Source: $HeadURL$
* Last changed: $LastChangedDate$
*
*
* the unrar licence applies to all junrar source and binary distributions
* you are not allowed to use this source to re-create the RAR compression algorithm
*
* Here some html entities which can be used for escaping javadoc tags:
* "&": "&" or "&"
* "<": "<" or "<"
* ">": ">" or ">"
* "@": "@"
*/
package org.fox.ttcomics2.junrar.rarfile;
import org.fox.ttcomics2.junrar.io.Raw;
public class MainHeader extends BaseBlock {
public static final short mainHeaderSizeWithEnc = 7;
public static final short mainHeaderSize = 6;
private short highPosAv;
private int posAv;
private byte encryptVersion;
public MainHeader(BaseBlock bb, byte[] mainHeader) {
super(bb);
int pos = 0;
highPosAv = Raw.readShortLittleEndian(mainHeader, pos);
pos += 2;
posAv = Raw.readIntLittleEndian(mainHeader, pos);
pos += 4;
if (hasEncryptVersion()) {
encryptVersion |= mainHeader[pos] & 0xff;
}
}
public boolean hasArchCmt() {
return (this.flags & BaseBlock.MHD_COMMENT) != 0;
}
public byte getEncryptVersion() {
return encryptVersion;
}
public short getHighPosAv() {
return highPosAv;
}
public int getPosAv() {
return posAv;
}
public boolean isEncrypted() {
return (this.flags & BaseBlock.MHD_PASSWORD) != 0;
}
public boolean isMultiVolume() {
return (this.flags & BaseBlock.MHD_VOLUME) != 0;
}
public boolean isFirstVolume() {
return (this.flags & BaseBlock.MHD_FIRSTVOLUME) != 0;
}
public void print() {
super.print();
StringBuilder str = new StringBuilder();
str.append("posav: " + getPosAv());
str.append("\nhighposav: " + getHighPosAv());
str.append("\nhasencversion: " + hasEncryptVersion() + (hasEncryptVersion() ? getEncryptVersion() : ""));
str.append("\nhasarchcmt: " + hasArchCmt());
str.append("\nisEncrypted: " + isEncrypted());
str.append("\nisMultivolume: " + isMultiVolume());
str.append("\nisFirstvolume: " + isFirstVolume());
str.append("\nisSolid: " + isSolid());
str.append("\nisLocked: " + isLocked());
str.append("\nisProtected: " + isProtected());
str.append("\nisAV: " + isAV());
}
public boolean isSolid() {
return (this.flags & MHD_SOLID) != 0;
}
public boolean isLocked() {
return (this.flags & MHD_LOCK) != 0;
}
public boolean isProtected() {
return (this.flags & MHD_PROTECT) != 0;
}
public boolean isAV() {
return (this.flags & MHD_AV) != 0;
}
public boolean isNewNumbering() {
return (this.flags & MHD_NEWNUMBERING) != 0;
}
}
|