Skip to content

Instantly share code, notes, and snippets.

@chalos
Last active December 14, 2016 10:42
Show Gist options
  • Save chalos/8fafa7729a6f250f83bb18695fb4ee4b to your computer and use it in GitHub Desktop.
Save chalos/8fafa7729a6f250f83bb18695fb4ee4b to your computer and use it in GitHub Desktop.
import java.util.Arrays;
import java.util.LinkedList;
import java.util.List;
public class TestObjectLoader {
public long create(String filename) throws Exception {
TestObject to = new TestObject();
to.randomGenerate();
System.out.println("Created Hash: " + String.valueOf( to.hashClass() ));
SerializationUtil.serialize(to, filename);
return to.hashClass();
}
public long load(String filename) throws Exception {
TestObject to = null;
to = (TestObject)SerializationUtil.deserialize(filename);
System.out.println("Load Hash: " + String.valueOf( to.hashClass() ));
return to.hashClass();
}
public static void main(String[] args) throws Exception {
//addSerializable("TestObject.class");
TestObjectLoader tol = new TestObjectLoader();
long h1 = tol.create("TestObjectLoaderOutput.bin");
long h2 = tol.load("TestObjectLoaderOutput.bin");
assert h1 == h2;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment