-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDownloadHelper.java
More file actions
61 lines (54 loc) · 1.48 KB
/
Copy pathDownloadHelper.java
File metadata and controls
61 lines (54 loc) · 1.48 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
51
52
53
54
55
56
57
58
59
60
61
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.RandomAccessFile;
/**
*
* @author tracy
*
* The class describes download task meta information.
* See download_task_meta_file.pptx
*/
public class DownloadHelper {
private RandomAccessFile logfile;
// public DownloadHelper(DownloadTask task) {
//
// }
public static void main(String[] args) {
File file = new File("./test");
try {
RandomAccessFile rFile = new RandomAccessFile(file, "rw");
rFile.writeLong(128);
rFile.seek(8);
rFile.writeLong(256);
rFile.seek(16);
rFile.writeLong(512);
rFile.seek(0);
rFile.writeLong(234);
rFile.seek(0);
long readLong = rFile.readLong();
System.out.println(readLong);
rFile.seek(8);
readLong = rFile.readLong();
System.out.println(readLong);
rFile.seek(16);
readLong = rFile.readLong();
System.out.println(readLong);
}
catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
public static long readOffset(int seq) {
// TODO Auto-generated method stub
return 0;
}
public static void writeOffSet(int seq, long count) {
// TODO Auto-generated method stub
}
}