ResourceUtil
public
class
ResourceUtil
extends Object
java.lang.Object | |
↳ | com.android.tradefed.util.ResourceUtil |
Utility for reading configuration resources.
Summary
Public constructors | |
---|---|
ResourceUtil()
|
Public methods | |
---|---|
static
boolean
|
extractResourceAsFile(String resource, File output)
DEPRECATED: Use extractResourceToFile Extracts a given resource to an output file. |
static
void
|
extractResourceToFile(String resource, File output)
Extracts a given resource to an output file. |
static
boolean
|
extractResourceWithAltAsFile(String resource, String altResourcePath, File output)
Extracts a given resource to an output file with fallback alternative path. |
static
|
readConfigurationFromFile(File propertyFile)
Read a property configuration from a file. |
static
|
readConfigurationFromResource(String resource)
Read a property configuration from the resources. |
static
|
readConfigurationFromStream(InputStream propertyStream)
Read a property configuration from a stream. |
Public constructors
ResourceUtil
public ResourceUtil ()
Public methods
extractResourceAsFile
public static boolean extractResourceAsFile (String resource, File output)
DEPRECATED: Use extractResourceToFile Extracts a given resource to an output file.
Parameters | |
---|---|
resource |
String |
output |
File |
Returns | |
---|---|
boolean |
extractResourceToFile
public static void extractResourceToFile (String resource, File output)
Extracts a given resource to an output file.
Parameters | |
---|---|
resource |
String |
output |
File |
extractResourceWithAltAsFile
public static boolean extractResourceWithAltAsFile (String resource, String altResourcePath, File output)
Extracts a given resource to an output file with fallback alternative path. Returns false if it fails.
Parameters | |
---|---|
resource |
String |
altResourcePath |
String |
output |
File |
Returns | |
---|---|
boolean |
readConfigurationFromFile
public staticreadConfigurationFromFile (File propertyFile)
Read a property configuration from a file. Configuration must follow a "key=value" or "key:value" format. Method is safe and will return an empty map in case of error.
Parameters | |
---|---|
propertyFile |
File : The path of the resource to read. |
Returns | |
---|---|
|
a ERROR(/Map) of the loaded resources. |
See also:
readConfigurationFromResource
public staticreadConfigurationFromResource (String resource)
Read a property configuration from the resources. Configuration must follow a "key=value" or "key:value" format. Method is safe and will return an empty map in case of error.
Parameters | |
---|---|
resource |
String : The path of the resource to read. |
Returns | |
---|---|
|
a ERROR(/Map) of the loaded resources. |
See also:
readConfigurationFromStream
public staticreadConfigurationFromStream (InputStream propertyStream)
Read a property configuration from a stream. Configuration must follow a "key=value" or "key:value" format. Method is safe and will return an empty map in case of error.
Parameters | |
---|---|
propertyStream |
InputStream : The path of the resource to read. |
Returns | |
---|---|
|
a ERROR(/Map) of the loaded resources. |
See also: