资源工具

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

使用 AltAsFile 提取资源

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)

也可以看看: