From ae0b2df66e7458c6810e6acf59899c4ba7b321d0 Mon Sep 17 00:00:00 2001 From: ItsHarry Date: Sun, 5 Jan 2014 21:07:39 +0100 Subject: [PATCH] Allow use of InputStream, this allows schematics to be loaded e.g. as a resource. --- .../worldedit/schematic/MCEditSchematicFormat.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/sk89q/worldedit/schematic/MCEditSchematicFormat.java b/src/main/java/com/sk89q/worldedit/schematic/MCEditSchematicFormat.java index d654bed5d..8aa56edbb 100644 --- a/src/main/java/com/sk89q/worldedit/schematic/MCEditSchematicFormat.java +++ b/src/main/java/com/sk89q/worldedit/schematic/MCEditSchematicFormat.java @@ -23,6 +23,7 @@ import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; +import java.io.InputStream; import java.util.ArrayList; import java.util.HashMap; import java.util.List; @@ -57,9 +58,7 @@ public class MCEditSchematicFormat extends SchematicFormat { super("MCEdit", "mcedit", "mce"); } - @Override - public CuboidClipboard load(File file) throws IOException, DataException { - FileInputStream stream = new FileInputStream(file); + public CuboidClipboard load(InputStream stream) throws IOException, DataException { NBTInputStream nbtStream = new NBTInputStream( new GZIPInputStream(stream)); @@ -194,6 +193,11 @@ public class MCEditSchematicFormat extends SchematicFormat { return clipboard; } + @Override + public CuboidClipboard load(File file) throws IOException, DataException { + return load(new FileInputStream(file)); + } + @Override public void save(CuboidClipboard clipboard, File file) throws IOException, DataException { int width = clipboard.getWidth();