Allow use of InputStream, this allows schematics to be loaded e.g. as a resource.

This commit is contained in:
ItsHarry 2014-01-05 21:07:39 +01:00
parent c25b9a53f2
commit ae0b2df66e

View File

@ -23,6 +23,7 @@ import java.io.File;
import java.io.FileInputStream; import java.io.FileInputStream;
import java.io.FileOutputStream; import java.io.FileOutputStream;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
@ -57,9 +58,7 @@ public class MCEditSchematicFormat extends SchematicFormat {
super("MCEdit", "mcedit", "mce"); super("MCEdit", "mcedit", "mce");
} }
@Override public CuboidClipboard load(InputStream stream) throws IOException, DataException {
public CuboidClipboard load(File file) throws IOException, DataException {
FileInputStream stream = new FileInputStream(file);
NBTInputStream nbtStream = new NBTInputStream( NBTInputStream nbtStream = new NBTInputStream(
new GZIPInputStream(stream)); new GZIPInputStream(stream));
@ -194,6 +193,11 @@ public class MCEditSchematicFormat extends SchematicFormat {
return clipboard; return clipboard;
} }
@Override
public CuboidClipboard load(File file) throws IOException, DataException {
return load(new FileInputStream(file));
}
@Override @Override
public void save(CuboidClipboard clipboard, File file) throws IOException, DataException { public void save(CuboidClipboard clipboard, File file) throws IOException, DataException {
int width = clipboard.getWidth(); int width = clipboard.getWidth();