blob: 89d7fbfbbfd212a149723770dd7780970d90a7a4 (
plain)
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
62
63
64
65
66
67
68
|
package com.keuin.kbackupfabric.ui;
import com.keuin.kbackupfabric.backup.incremental.serializer.IncBackupInfoSerializer;
import com.keuin.kbackupfabric.backup.incremental.serializer.SavedIncrementalBackup;
import com.keuin.kbackupfabric.operation.backup.method.ConfiguredBackupMethod;
import net.minecraft.server.MinecraftServer;
import java.io.File;
import java.io.IOException;
import java.time.LocalDateTime;
import java.time.ZoneId;
/**
* Used in UI part.
*/
public class IncrementalBackupInfo implements BackupInfo {
private final String name;
private final LocalDateTime creationTime;
private final long sizeBytes;
private final String fileName;
private IncrementalBackupInfo(String name, LocalDateTime creationTime, long sizeBytes, String fileName) {
this.name = name;
this.creationTime = creationTime;
this.sizeBytes = sizeBytes;
this.fileName = fileName;
}
public static IncrementalBackupInfo fromFile(File indexFile) throws IOException {
SavedIncrementalBackup info = IncBackupInfoSerializer.fromFile(indexFile);
return new IncrementalBackupInfo(
info.getBackupName(),
info.getBackupTime().withZoneSameInstant(ZoneId.systemDefault()).toLocalDateTime(),
info.getTotalSizeBytes(),
indexFile.getName()
);
}
@Override
public String getName() {
return name;
}
@Override
public LocalDateTime getCreationTime() {
return creationTime;
}
@Override
public long getSizeBytes() {
return sizeBytes;
}
@Override
public String getType() {
return "Incremental";
}
@Override
public ConfiguredBackupMethod createConfiguredBackupMethod(MinecraftServer server) {
throw new RuntimeException("not implemented");
}
@Override
public String getBackupFileName() {
return fileName;
}
}
|