Project

General

Profile

Statistics
| Revision:

root / project / src / main / java / file / FileChunk.java @ 1

History | View | Annotate | Download (943 Bytes)

1
package main.java.file;
2

    
3
import java.io.Serializable;
4

    
5
public class FileChunk implements Serializable {
6

    
7
    private static final long serialVersionUID = 1L;
8

    
9
    private static final int CHUNK_MAX_SIZE = 64000;
10
    private int replicationDegree;
11
    private int chunkNo;
12
    private FileID fileID;
13
    private byte[] chunkData;
14

    
15
    public FileChunk(int replicationDegree, int chunkNo, FileID fileID, byte[] chunkData) {
16
        this.replicationDegree = replicationDegree;
17
        this.chunkNo = chunkNo;
18
        this.fileID = fileID;
19
        this.chunkData = chunkData;
20
    }
21

    
22
    public int getChunkNo() {
23
        return chunkNo;
24
    }
25

    
26
    public FileID getFileID() {
27
        return fileID;
28
    }
29

    
30
    public byte[] getChunkData() {
31
        return chunkData;
32
    }
33

    
34
    public int getReplicationDegree() {
35
        return replicationDegree;
36
    }
37

    
38
    @Override
39
    public String toString() {
40
        return new String(chunkData);
41
    }
42
}
43