-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFileData.java
More file actions
51 lines (43 loc) · 1.08 KB
/
FileData.java
File metadata and controls
51 lines (43 loc) · 1.08 KB
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
import java.io.Serializable;
/**
* This is a class for transfer file metadata
* Author: Yuqi Liu
*/
public class FileData implements Serializable {
public long len; // data size
public byte[] data; // file data
public long version = -1; // file version
public boolean isDir = false; // file is directory?
public boolean isExist = false; // file exist
public boolean isError = false; // file error occurs?
public String ErrorMsg; // file error message
public Lease lease; // lease
public FileData(long len, byte[] data) {
this.len = len;
this.data = data;
}
/**
* Check if a file is a directory
* @return true or false
*/
public boolean isDirectory() { return this.isDir; }
/**
* Check if a file exists
* @return
*/
public boolean exists() { return this.isExist; }
/**
* Set an error flag and error message
* @param error
*/
public void setError(String error) {
this.isError = true;
this.ErrorMsg = error;
}
/**
* Flush the data.
*/
public void flush() {
data = null;
}
}