Added support for dumping a bundle metadata file directly in addition to

extracting it from a bundle.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@2732 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Michael Bayne
2003-07-28 04:07:30 +00:00
parent 42b84f894f
commit 7961683cb0
2 changed files with 33 additions and 6 deletions
@@ -1,9 +1,11 @@
//
// $Id: BundleUtil.java,v 1.3 2003/05/14 21:34:01 ray Exp $
// $Id: BundleUtil.java,v 1.4 2003/07/28 04:07:30 mdb Exp $
package com.threerings.media.tile.bundle;
import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.ObjectInputStream;
@@ -40,4 +42,23 @@ public class BundleUtil
StreamUtil.close(tbin);
}
}
/**
* Extracts, but does not initialize, a serialized tileset bundle
* instance from the supplied file.
*/
public static TileSetBundle extractBundle (File file)
throws IOException, ClassNotFoundException
{
// unserialize the tileset bundles array
FileInputStream fin = new FileInputStream(file);
try {
ObjectInputStream oin = new ObjectInputStream(
new BufferedInputStream(fin));
TileSetBundle tsb = (TileSetBundle)oin.readObject();
return tsb;
} finally {
StreamUtil.close(fin);
}
}
}