Extract FileResourceBundle into a separate subclass and hide it away from the
rest of the world. git-svn-id: svn+ssh://src.earth.threerings.net/nenya/trunk@312 ed5b42cb-e716-0410-a449-f6a68f950b19
This commit is contained in:
@@ -22,7 +22,7 @@
|
||||
package com.threerings.media.tile.bundle;
|
||||
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.io.File;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.ObjectInputStream;
|
||||
import java.io.ObjectOutputStream;
|
||||
@@ -36,30 +36,21 @@ import com.threerings.media.image.ImageDataProvider;
|
||||
import com.threerings.media.tile.TileSet;
|
||||
|
||||
/**
|
||||
* A tileset bundle is used to load up tilesets by id from a persistent
|
||||
* bundle of tilesets stored on the local filesystem.
|
||||
* A tileset bundle is used to load up tilesets by id from a persistent bundle of tilesets stored
|
||||
* on the local filesystem.
|
||||
*/
|
||||
public class TileSetBundle extends HashIntMap
|
||||
implements Serializable, ImageDataProvider
|
||||
{
|
||||
/**
|
||||
* Initializes this resource bundle with a reference to the jarfile
|
||||
* from which it was loaded and from which it can load image data. The
|
||||
* image manager will be used to decode the images.
|
||||
* Initializes this resource bundle with a reference to the jarfile from which it was loaded
|
||||
* and from which it can load image data. The image manager will be used to decode the images.
|
||||
*/
|
||||
public void init (ResourceBundle bundle)
|
||||
{
|
||||
_bundle = bundle;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the bundle file from which our tiles are fetched.
|
||||
*/
|
||||
public File getSource ()
|
||||
{
|
||||
return _bundle.getSource();
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a tileset to this tileset bundle.
|
||||
*/
|
||||
@@ -95,7 +86,7 @@ public class TileSetBundle extends HashIntMap
|
||||
// documentation inherited from interface
|
||||
public String getIdent ()
|
||||
{
|
||||
return "tsb:" + _bundle.getSource();
|
||||
return "tsb:" + _bundle.getIdent();
|
||||
}
|
||||
|
||||
// documentation inherited from interface
|
||||
@@ -135,7 +126,7 @@ public class TileSetBundle extends HashIntMap
|
||||
/** That from which we load our tile images. */
|
||||
protected transient ResourceBundle _bundle;
|
||||
|
||||
/** Increase this value when object's serialized state is impacted by
|
||||
* a class change (modification of fields, inheritance). */
|
||||
/** Increase this value when object's serialized state is impacted by a class change
|
||||
* (modification of fields, inheritance). */
|
||||
private static final long serialVersionUID = 2;
|
||||
}
|
||||
|
||||
@@ -24,6 +24,7 @@ package com.threerings.media.tile.bundle.tools;
|
||||
import java.io.File;
|
||||
import java.util.Iterator;
|
||||
|
||||
import com.threerings.resource.FileResourceBundle;
|
||||
import com.threerings.resource.ResourceManager;
|
||||
import com.threerings.resource.ResourceBundle;
|
||||
|
||||
@@ -63,7 +64,7 @@ public class DumpBundle
|
||||
try {
|
||||
TileSetBundle tsb = null;
|
||||
if (args[i].endsWith(".jar")) {
|
||||
ResourceBundle bundle = new ResourceBundle(file);
|
||||
ResourceBundle bundle = new FileResourceBundle(file);
|
||||
tsb = BundleUtil.extractBundle(bundle);
|
||||
tsb.init(bundle);
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user