From a040ab4832ddf3860bbd55a994f8a3dec7532494 Mon Sep 17 00:00:00 2001 From: Michael Bayne Date: Tue, 20 Nov 2001 03:46:28 +0000 Subject: [PATCH] Added containsResource() and a sensible toString(). git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@627 542714f4-19e9-0310-aa3c-eee0fc999fb1 --- .../threerings/resource/ResourceBundle.java | 21 ++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/src/java/com/threerings/resource/ResourceBundle.java b/src/java/com/threerings/resource/ResourceBundle.java index c6f7cef39..b2d354c6b 100644 --- a/src/java/com/threerings/resource/ResourceBundle.java +++ b/src/java/com/threerings/resource/ResourceBundle.java @@ -1,5 +1,5 @@ // -// $Id: ResourceBundle.java,v 1.1 2001/11/20 00:21:41 mdb Exp $ +// $Id: ResourceBundle.java,v 1.2 2001/11/20 03:46:28 mdb Exp $ package com.threerings.resource; @@ -55,6 +55,25 @@ public class ResourceBundle return stream; } + /** + * Returns true if this resource bundle contains the resource with the + * specified path. This avoids actually loading the resource, in the + * event that the caller only cares to know that the resource exists. + */ + public boolean containsResource (String path) + { + return (_source.getJarEntry(path) != null); + } + + /** + * Returns a string representation of this resource bundle. + */ + public String toString () + { + return "[path=" + _source.getName() + + ", entries=" + _source.size() + "]"; + } + /** The jar file from which we load resources. */ protected JarFile _source; }