ResourceUtil
public
class
ResourceUtil
extends Object
| java.lang.Object | |
| ↳ | com.android.tradefed.util.ResourceUtil |
Utilitas untuk membaca resource konfigurasi.
Ringkasan
Konstruktor publik | |
|---|---|
ResourceUtil()
|
|
Metode publik | |
|---|---|
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
Map<String, String>
|
readConfigurationFromFile(File propertyFile)
Read a property configuration from a file. |
static
Map<String, String>
|
readConfigurationFromResource(String resource)
Read a property configuration from the resources. |
static
Map<String, String>
|
readConfigurationFromStream(InputStream propertyStream)
Read a property configuration from a stream. |
Konstruktor publik
ResourceUtil
public ResourceUtil ()
Metode publik
extractResourceAsFile
public static boolean extractResourceAsFile (String resource,
File output)DEPRECATED: Use extractResourceToFile Extracts a given resource to an output file.
| Parameter | |
|---|---|
resource |
String |
output |
File |
| Hasil | |
|---|---|
boolean |
|
extractResourceToFile
public static void extractResourceToFile (String resource,
File output)Extracts a given resource to an output file.
| Parameter | |
|---|---|
resource |
String |
output |
File |
| Menampilkan | |
|---|---|
IOException |
|
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.
| Parameter | |
|---|---|
resource |
String |
altResourcePath |
String |
output |
File |
| Hasil | |
|---|---|
boolean |
|
readConfigurationFromFile
public static Map<String, String> readConfigurationFromFile (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.
| Parameter | |
|---|---|
propertyFile |
File: The path of the resource to read. |
| Hasil | |
|---|---|
Map<String, String> |
a Map of the loaded resources. |
Lihat juga:
readConfigurationFromResource
public static Map<String, String> readConfigurationFromResource (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.
| Parameter | |
|---|---|
resource |
String: The path of the resource to read. |
| Hasil | |
|---|---|
Map<String, String> |
a Map of the loaded resources. |
Lihat juga:
readConfigurationFromStream
public static Map<String, String> readConfigurationFromStream (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.
| Parameter | |
|---|---|
propertyStream |
InputStream: The path of the resource to read. |
| Hasil | |
|---|---|
Map<String, String> |
a Map of the loaded resources. |
Lihat juga: