资源利用

public class ResourceUtil
extends Object

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


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

概括

公共构造函数

ResourceUtil ()

公共方法

static boolean extractResourceAsFile (String resource, File output)

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

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

使用回退替代路径将给定资源提取到输出文件。

static readConfigurationFromFile (File propertyFile)

从文件中读取属性配置。

static readConfigurationFromResource (String resource)

从资源中读取属性配置。

static readConfigurationFromStream (InputStream propertyStream)

从流中读取属性配置。

公共构造函数

资源利用

public ResourceUtil ()

公共方法

提取资源作为文件

public static boolean extractResourceAsFile (String resource, 
                File output)

将给定资源提取到输出文件。如果失败则返回 false。

参数
resource String

output File

退货
boolean

extractResourceWithAltAsFile

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

使用回退替代路径将给定资源提取到输出文件。如果失败则返回 false。

参数
resource String

altResourcePath String

output File

退货
boolean

从文件读取配置

public static  readConfigurationFromFile (File propertyFile)

从文件中读取属性配置。配置必须遵循“key=value”或“key:value”格式。方法是安全的,如果出错将返回一个空映射。

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

退货
加载资源的ERROR(/Map)

也可以看看:

从资源读取配置

public static  readConfigurationFromResource (String resource)

从资源中读取属性配置。配置必须遵循“key=value”或“key:value”格式。方法是安全的,如果出错将返回一个空映射。

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

退货
加载资源的ERROR(/Map)

也可以看看:

从流中读取配置

public static  readConfigurationFromStream (InputStream propertyStream)

从流中读取属性配置。配置必须遵循“key=value”或“key:value”格式。方法是安全的,如果出错将返回一个空映射。

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

退货
加载资源的ERROR(/Map)

也可以看看: