1
0
mirror of https://github.com/mitb-archive/filebot synced 2024-08-13 17:03:45 -04:00
filebot/source/net/sourceforge/tuned/FastFile.java
Reinhard Pointner 9d7af8bd96 * dnd move: cancel background threads when calling BackgroundFileTransferablePolicy.clear()
* added FastFile, which minimizes fs calls by remembering the results
* use File directly (and not the holder FileEntry) in RenamePanel
2009-02-12 22:04:17 +00:00

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;
}
}