Fixed a lot of logic, replaced Files with Documents

This commit is contained in:
2023-10-17 16:48:44 +03:00
parent 3589237e33
commit 15887bd1b6
10 changed files with 128 additions and 37 deletions

View File

@@ -56,4 +56,20 @@ public class Document extends File implements IDocument {
public FileType getFileType() {
return fileType;
}
@Override
public long getFilesizeKB() {
try {
BasicFileAttributes fileAttributes = Files.readAttributes(Path.of(this.getPath()), BasicFileAttributes.class);
return fileAttributes.size() / 1024;
} catch (IOException e) {
e.printStackTrace();
}
return 0;
}
@Override
public String getInfo() {
return "Name: " + getName() + " Size: " + getFilesizeKB() + "Type: " + getFileType().getTypeName();
}
}