Progress on New Save Format

Integrated the base code for our new save format. It still needs more
work but at least some substance is there. Ignore the file not found
messages that come up when trying to save the world's data - since we're
not actually writing files, an exception occurs when we some later code
tries to move non-existent save files.

Also moved the FileFilter functionality out of DungeonHelper and into
its own class, FileFilters, since it's finally needed more broadly.
This commit is contained in:
SenseiKiwi
2013-09-11 22:13:42 -04:00
parent 1d3038288b
commit c2fa4964f8
12 changed files with 397 additions and 93 deletions

View File

@@ -0,0 +1,51 @@
package StevenDimDoors.mod_pocketDim.util;
import java.io.File;
import java.io.FileFilter;
import java.util.regex.Pattern;
public class FileFilters
{
private FileFilters() { }
public static class DirectoryFilter implements FileFilter
{
@Override
public boolean accept(File file)
{
return file.isDirectory();
}
}
public static class FileExtensionFilter implements FileFilter
{
private final String extension;
public FileExtensionFilter(String extension)
{
this.extension = extension;
}
@Override
public boolean accept(File file)
{
return file.isFile() && file.getName().endsWith(extension);
}
}
public static class RegexFileFilter implements FileFilter
{
private final Pattern pattern;
public RegexFileFilter(String expression)
{
this.pattern = Pattern.compile(expression);
}
@Override
public boolean accept(File file)
{
return file.isFile() && pattern.matcher(file.getName()).matches();
}
}
}