ResourceUtil

public class ResourceUtil
extends Object

java.lang.Object
   ↳ com.android.tradefed.util.ResourceUtil


用于读取配置资源的实用程序。

摘要

公共构造函数

ResourceUtil()

公共方法

static boolean extractResourceAsFile(String resource, File output)

已弃用:请改用 extractResourceToFile 将指定资源提取到输出文件中。

static void extractResourceToFile(String resource, File output)

将指定资源提取到输出文件。

static boolean extractResourceWithAltAsFile(String resource, String altResourcePath, File output)

将指定资源提取到具有回退替代路径的输出文件。

static Map<String, String> readConfigurationFromFile(File propertyFile)

从文件中读取媒体资源配置。

static Map<String, String> readConfigurationFromResource(String resource)

从资源中读取媒体资源配置。

static Map<String, String> readConfigurationFromStream(InputStream propertyStream)

从数据流中读取媒体资源配置。

公共构造函数

ResourceUtil

public ResourceUtil ()

公共方法

extractResourceAsFile

public static boolean extractResourceAsFile (String resource, 
                File output)

已弃用:请改用 extractResourceToFile 将指定资源提取到输出文件中。

参数
resource String

output File

返回
boolean

extractResourceToFile

public static void extractResourceToFile (String resource, 
                File output)

将指定资源提取到输出文件中。

参数
resource String

output File

抛出
IOException

extractResourceWithAltAsFile

public static boolean extractResourceWithAltAsFile (String resource, 
                String altResourcePath, 
                File output)

将指定资源提取到具有回退替代路径的输出文件。如果失败,则返回 false。

参数
resource String

altResourcePath String

output File

返回
boolean

readConfigurationFromFile

public static Map<String, String> readConfigurationFromFile (File propertyFile)

从文件中读取媒体资源配置。配置必须采用“键=值”或“键:值”格式。该方法是安全的,如果出现错误,将返回一个空映射。

参数
propertyFile File:要读取的资源的路径。

返回
Map<String, String> 已加载资源的 Map

另见:

readConfigurationFromResource

public static Map<String, String> readConfigurationFromResource (String resource)

从资源中读取媒体资源配置。配置必须采用“键=值”或“键:值”格式。该方法是安全的,如果出现错误,将返回一个空映射。

参数
resource String:要读取的资源的路径。

返回
Map<String, String> 已加载资源的 Map

另见:

readConfigurationFromStream

public static Map<String, String> readConfigurationFromStream (InputStream propertyStream)

从数据流读取媒体资源配置。配置必须采用“键=值”或“键:值”格式。该方法是安全的,如果出现错误,将返回一个空映射。

参数
propertyStream InputStream:要读取的资源的路径。

返回
Map<String, String> 已加载资源的 Map

另见: