summaryrefslogtreecommitdiff
path: root/org.fox.ttcomics/src/main/java/com/github/junrar/rarfile/UnixOwnersHeader.java
blob: 192ba7a0e1bf780ab601dd7b5f3feb2ad1b64bbd (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
package com.github.junrar.rarfile;

import com.github.junrar.io.Raw;


public class UnixOwnersHeader 
extends SubBlockHeader 
{
	//private Log //logger = LogFactory.getLog(UnixOwnersHeader.class);
	private int ownerNameSize;
	private int groupNameSize;
	private String owner;
	private String group;
	
	public  UnixOwnersHeader(SubBlockHeader sb, byte[] uoHeader) {
		super(sb);
		int pos = 0;
		ownerNameSize = Raw.readShortLittleEndian(uoHeader, pos)&0xFFFF;
		pos+=2;
		groupNameSize = Raw.readShortLittleEndian(uoHeader, pos)&0xFFFF;
		pos+=2;
		if(pos+ownerNameSize<uoHeader.length){
			byte[] ownerBuffer = new byte[ownerNameSize];
			System.arraycopy(uoHeader, pos, ownerBuffer, 0, ownerNameSize);
			owner = new String(ownerBuffer);
		}
		pos+=ownerNameSize;
		if(pos+groupNameSize<uoHeader.length){
			byte[] groupBuffer = new byte[groupNameSize];
			System.arraycopy(uoHeader, pos, groupBuffer, 0, groupNameSize);
			group = new String(groupBuffer);
		}
	}
	/**
	 * @return the group
	 */
	public String getGroup() {
		return group;
	}
	/**
	 * @param group the group to set
	 */
	public void setGroup(String group) {
		this.group = group;
	}
	/**
	 * @return the groupNameSize
	 */
	public int getGroupNameSize() {
		return groupNameSize;
	}
	/**
	 * @param groupNameSize the groupNameSize to set
	 */
	public void setGroupNameSize(int groupNameSize) {
		this.groupNameSize = groupNameSize;
	}
	/**
	 * @return the owner
	 */
	public String getOwner() {
		return owner;
	}
	/**
	 * @param owner the owner to set
	 */
	public void setOwner(String owner) {
		this.owner = owner;
	}
	/**
	 * @return the ownerNameSize
	 */
	public int getOwnerNameSize() {
		return ownerNameSize;
	}
	/**
	 * @param ownerNameSize the ownerNameSize to set
	 */
	public void setOwnerNameSize(int ownerNameSize) {
		this.ownerNameSize = ownerNameSize;
	}
	
	/* (non-Javadoc)
	 * @see de.innosystec.unrar.rarfile.SubBlockHeader#print()
	 */
	public void print(){
		super.print();
		//logger.info("ownerNameSize: "+ownerNameSize);
		//logger.info("owner: "+owner);
		//logger.info("groupNameSize: "+groupNameSize);
		//logger.info("group: "+group);
	}
}