com.threerings.util
Class ResourceUtil

java.lang.Object
  extended by com.threerings.util.ResourceUtil

public class ResourceUtil
extends Object

Utility methods relating to resources.


Constructor Summary
ResourceUtil()
           
 
Method Summary
static String getPreferredResourceDir()
          Returns the resource directory stored in the preferences, which (if present) overrides the default resource directory.
static InputStream getResourceAsStream(String path)
          Gets the identified resource as a stream, logging an error and returning an empty stream if it doesn't exist.
static Properties loadProperties(String path)
          Reads a set of properties from a resource.
static String[] loadStrings(String path)
          Reads a list of newline-delimited strings from a resource.
static void setPreferredResourceDir(String dir)
          Sets the preferred resource directory.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ResourceUtil

public ResourceUtil()
Method Detail

getPreferredResourceDir

public static String getPreferredResourceDir()
Returns the resource directory stored in the preferences, which (if present) overrides the default resource directory.

Returns:
the stored resource directory, or null to use the default.

setPreferredResourceDir

public static void setPreferredResourceDir(String dir)
Sets the preferred resource directory.

Parameters:
dir - the resource directory to store, or null to use to the default.

loadStrings

public static String[] loadStrings(String path)
Reads a list of newline-delimited strings from a resource.


loadProperties

public static Properties loadProperties(String path)
Reads a set of properties from a resource.


getResourceAsStream

public static InputStream getResourceAsStream(String path)
Gets the identified resource as a stream, logging an error and returning an empty stream if it doesn't exist.



Copyright © 2011. All Rights Reserved.