root / chunk / Chunk.java @ 10
History | View | Annotate | Download (1.52 KB)
1 | 10 | up20160473 | package chunk; |
---|---|---|---|
2 | |||
3 | import java.io.IOException; |
||
4 | import java.io.Serializable; |
||
5 | |||
6 | public class Chunk implements Serializable{ |
||
7 | private String fileId; //Hash256 |
||
8 | private int chunkNum; //Starts with 0 |
||
9 | private int repDeg; //Desired Rep degree |
||
10 | private int currentRepDeg = 0; //Actual Rep degree |
||
11 | private int chunkSize; //MAX 64000kbytes |
||
12 | private byte[] info; // chunk itself |
||
13 | |||
14 | public Chunk(int chunkNum, byte[] content, int chunkSize) throws IOException { //BACKUP CHUNKS |
||
15 | |||
16 | this.chunkNum = chunkNum;
|
||
17 | this.info = content;
|
||
18 | this.chunkSize = chunkSize;
|
||
19 | } |
||
20 | |||
21 | public Chunk(int chunkNum, String fileId , int repDeg, int chunkSize) throws IOException { //BACKUP CHUNKS |
||
22 | |||
23 | this.chunkNum = chunkNum;
|
||
24 | this.fileId = fileId;
|
||
25 | this.repDeg = repDeg;
|
||
26 | this.chunkSize = chunkSize;
|
||
27 | } |
||
28 | |||
29 | public String getfileId() { |
||
30 | return fileId;
|
||
31 | } |
||
32 | |||
33 | public int getNum() { |
||
34 | return chunkNum;
|
||
35 | } |
||
36 | |||
37 | |||
38 | public int getRepDegree() { |
||
39 | return repDeg;
|
||
40 | } |
||
41 | |||
42 | public int getActualRepDegree() { |
||
43 | return currentRepDeg;
|
||
44 | } |
||
45 | |||
46 | public int getchunkSize() { |
||
47 | return chunkSize;
|
||
48 | } |
||
49 | |||
50 | public byte[] getContent(){ |
||
51 | return info;
|
||
52 | } |
||
53 | |||
54 | public void setCurrentRepDegree(int degree){ |
||
55 | this.currentRepDeg = degree;
|
||
56 | } |
||
57 | |||
58 | public void setRepDegree(int degree){ |
||
59 | this.repDeg = degree;
|
||
60 | } |
||
61 | |||
62 | public void setFileId(String id){ |
||
63 | this.fileId = id;
|
||
64 | } |
||
65 | |||
66 | public void setContent(byte[] content){ |
||
67 | this.info = content;
|
||
68 | } |
||
69 | } |