public class WorldIO
extends java.lang.Object
worlds
in
the WorldPainter binary file format, with support for metadata and for
loading and migrating legacy formats.
Created by Pepijn Schmitz on 02-07-15.
Modifier and Type | Method and Description |
---|---|
World2 |
getWorld() |
void |
load(java.io.InputStream in)
Load a world from a binary stream to which it was previously saved by
save(OutputStream) , or by a previous version of WorldPainter. |
void |
save(java.io.OutputStream out)
Save the world to a binary stream, such that it can later be loaded using
load(InputStream) . |
void |
saveCompartmentalised(java.io.OutputStream out)
Save the world to a binary stream, such that it can later be loaded using
load(InputStream) . |
void |
setWorld(World2 world) |
public WorldIO()
public WorldIO(World2 world)
public World2 getWorld()
public void setWorld(World2 world)
public void save(java.io.OutputStream out) throws java.io.IOException
load(InputStream)
. The stream is closed before returning.out
- The stream to which to save the world.java.io.IOException
- If an I/O error occurred saving the world.public void saveCompartmentalised(java.io.OutputStream out) throws java.io.IOException
load(InputStream)
. The stream
is closed before returning.
This version uses a format that compresses every region separately, for faster access to individual regions without having to load the entire world.
out
- The stream to which to save the world.java.io.IOException
- If an I/O error occurred saving the world.public void load(java.io.InputStream in) throws java.io.IOException, UnloadableWorldException
save(OutputStream)
, or by a previous version of WorldPainter.
The stream is closed before returning.in
- The stream from which to load the world.java.io.IOException
- If an I/O error occurred loading the world.UnloadableWorldException
- If some other error occurred loading the
world. If metadata was present and could be loaded it will be stored
in the exception.