mirror of
https://github.com/mitb-archive/filebot
synced 2024-11-04 16:35:08 -05:00
9d7af8bd96
* added FastFile, which minimizes fs calls by remembering the results * use File directly (and not the holder FileEntry) in RenamePanel
56 lines
874 B
Java
56 lines
874 B
Java
|
|
package net.sourceforge.tuned;
|
|
|
|
|
|
import java.io.File;
|
|
|
|
|
|
public class FastFile extends File {
|
|
|
|
private Long length;
|
|
private Boolean isDirectory;
|
|
private Boolean isFile;
|
|
|
|
|
|
public FastFile(String path) {
|
|
super(path);
|
|
}
|
|
|
|
|
|
public FastFile(File parent, String child) {
|
|
super(parent, child);
|
|
}
|
|
|
|
|
|
@Override
|
|
public long length() {
|
|
return length != null ? length : (length = super.length());
|
|
}
|
|
|
|
|
|
@Override
|
|
public boolean isDirectory() {
|
|
return isDirectory != null ? isDirectory : (isDirectory = super.isDirectory());
|
|
}
|
|
|
|
|
|
@Override
|
|
public boolean isFile() {
|
|
return isFile != null ? isFile : (isFile = super.isFile());
|
|
}
|
|
|
|
|
|
@Override
|
|
public File[] listFiles() {
|
|
String[] names = list();
|
|
File[] files = new File[names.length];
|
|
|
|
for (int i = 0; i < names.length; i++) {
|
|
files[i] = new FastFile(this, names[i]);
|
|
}
|
|
|
|
return files;
|
|
}
|
|
|
|
}
|