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:
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user