Close streams immediately after using them.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@2575 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// $Id: BundleUtil.java,v 1.2 2001/11/30 02:34:57 mdb Exp $
|
||||
// $Id: BundleUtil.java,v 1.3 2003/05/14 21:34:01 ray Exp $
|
||||
|
||||
package com.threerings.media.tile.bundle;
|
||||
|
||||
@@ -8,6 +8,8 @@ import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.ObjectInputStream;
|
||||
|
||||
import com.samskivert.io.StreamUtil;
|
||||
|
||||
import com.threerings.resource.ResourceBundle;
|
||||
|
||||
/**
|
||||
@@ -27,10 +29,15 @@ public class BundleUtil
|
||||
throws IOException, ClassNotFoundException
|
||||
{
|
||||
// unserialize the tileset bundles array
|
||||
InputStream tbin = bundle.getResource(METADATA_PATH);
|
||||
ObjectInputStream oin = new ObjectInputStream(
|
||||
new BufferedInputStream(tbin));
|
||||
TileSetBundle tsb = (TileSetBundle)oin.readObject();
|
||||
return tsb;
|
||||
InputStream tbin = null;
|
||||
try {
|
||||
tbin = bundle.getResource(METADATA_PATH);
|
||||
ObjectInputStream oin = new ObjectInputStream(
|
||||
new BufferedInputStream(tbin));
|
||||
TileSetBundle tsb = (TileSetBundle)oin.readObject();
|
||||
return tsb;
|
||||
} finally {
|
||||
StreamUtil.close(tbin);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user