Subversion Repositories Code-Repo

Rev

Rev 95 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
95 Kevin 1
 
2
public class BufferBlock {
3
	private long startAddress;
4
	private byte[] bytes;
5
	private int size;
6
	private BufferBlock prev;
7
	private BufferBlock next;
8
	private boolean dirtyBit;
9
 
10
	public BufferBlock(int sz) {
11
		setStartAddress(-1);
12
		bytes = new byte[sz];
13
		this.size = sz;
14
		prev = null;
15
		next = null;
16
		setDirtyBit(false);
17
	}
18
 
19
	// Copies size bytes starting from address to out
20
	public void getBytes(byte[] out, int address, int size) {
21
		for (int i = 0; i < size; i++) {
22
			out[i] = bytes[address + i];
23
		}
24
	}
25
 
26
	// Puts size bytes starting from address from in
27
	public void setBytes(byte[] in, int address, int size) {
28
		for (int i = 0; i < size; i++) {
29
			bytes[address + i] = in[i]; 
30
		}
31
	}
32
 
33
	public BufferBlock getPrev() {
34
		return prev;
35
	}
36
	public void setPrev(BufferBlock prev) {
37
		this.prev = prev;
38
	}
39
	public BufferBlock getNext() {
40
		return next;
41
	}
42
	public void setNext(BufferBlock next) {
43
		this.next = next;
44
	}
45
	public int getSize() {
46
		return size;
47
	}
48
	public boolean isDirtyBit() {
49
		return dirtyBit;
50
	}
51
	public void setDirtyBit(boolean dirtyBit) {
52
		this.dirtyBit = dirtyBit;
53
	}
54
	public long getStartAddress() {
55
		return startAddress;
56
	}
57
	public void setStartAddress(long startAddress) {
58
		this.startAddress = startAddress;
59
	}
60
}