自 2025 年 3 月 27 日起,我们建议您使用 android-latest-release
而非 aosp-main
构建 AOSP 并为其做出贡献。如需了解详情,请参阅 AOSP 的变更。
RemoteFileUtil
public
class
RemoteFileUtil
extends Object
java.lang.Object
|
↳ |
com.android.tradefed.device.cloud.RemoteFileUtil
|
用于处理来自远程实例的文件的实用程序类
摘要
公共方法 |
static
boolean
|
doesRemoteFileExist(GceAvdInfo remoteInstance, TestDeviceOptions options, IRunUtil runUtil, long timeout, String remotePath)
检查远程实例中是否存在文件(或目录)
|
static
File
|
fetchRemoteDir(GceAvdInfo remoteInstance, TestDeviceOptions options, IRunUtil runUtil, long timeout, String remoteDirPath)
从远程主机提取远程目录。
|
static
boolean
|
fetchRemoteDir(GceAvdInfo remoteInstance, TestDeviceOptions options, IRunUtil runUtil, long timeout, String remoteDirPath, File localDir)
从远程主机提取远程目录。
|
static
File
|
fetchRemoteFile(GceAvdInfo remoteInstance, TestDeviceOptions options, IRunUtil runUtil, long timeout, String remoteFilePath)
在容器实例中提取远程文件。
|
static
boolean
|
fetchRemoteFile(GceAvdInfo remoteInstance, TestDeviceOptions options, IRunUtil runUtil, long timeout, String remoteFilePath, File localFile)
在设备或容器实例中提取远程文件。
|
static
boolean
|
pushFileToRemote(GceAvdInfo remoteInstance, TestDeviceOptions options, scpArgs, IRunUtil runUtil, long timeout, String remoteFilePath, File localFile)
将 ERROR(/File) 从本地主机推送到远程实例
|
公共构造函数
RemoteFileUtil
public RemoteFileUtil ()
公共方法
doesRemoteFileExist
public static boolean doesRemoteFileExist (GceAvdInfo remoteInstance,
TestDeviceOptions options,
IRunUtil runUtil,
long timeout,
String remotePath)
检查远程实例上是否存在文件(或目录)
参数 |
remoteInstance |
GceAvdInfo :用于描述设备的 GceAvdInfo 。 |
options |
TestDeviceOptions :一个 TestDeviceOptions ,用于描述要为 GCE 设备使用的设备选项。 |
runUtil |
IRunUtil :用于执行命令的 IRunUtil 。 |
timeout |
long :提取完成所需的毫秒数 |
remotePath |
String :用于查找文件的远程路径。 |
fetchRemoteDir
public static File fetchRemoteDir (GceAvdInfo remoteInstance,
TestDeviceOptions options,
IRunUtil runUtil,
long timeout,
String remoteDirPath)
从远程主机提取远程目录。
参数 |
remoteInstance |
GceAvdInfo :用于描述设备的 GceAvdInfo 。 |
options |
TestDeviceOptions :一个 TestDeviceOptions ,用于描述要为 GCE 设备使用的设备选项。 |
runUtil |
IRunUtil :用于执行命令的 IRunUtil 。 |
timeout |
long :提取完成所需的毫秒数 |
remoteDirPath |
String :用于查找目录的远程路径。 |
fetchRemoteDir
public static boolean fetchRemoteDir (GceAvdInfo remoteInstance,
TestDeviceOptions options,
IRunUtil runUtil,
long timeout,
String remoteDirPath,
File localDir)
从远程主机提取远程目录。
参数 |
remoteInstance |
GceAvdInfo :用于描述设备的 GceAvdInfo 。 |
options |
TestDeviceOptions :一个 TestDeviceOptions ,用于描述要为 GCE 设备使用的设备选项。 |
runUtil |
IRunUtil :用于执行命令的 IRunUtil 。 |
timeout |
long :提取完成所需的毫秒数 |
remoteDirPath |
String :用于查找目录的远程路径。 |
localDir |
File :用于放置拉取的文件的本地目录。 |
返回 |
boolean |
如果成功则返回 true,否则返回 false |
fetchRemoteFile
public static File fetchRemoteFile (GceAvdInfo remoteInstance,
TestDeviceOptions options,
IRunUtil runUtil,
long timeout,
String remoteFilePath)
在容器实例中提取远程文件。
参数 |
remoteInstance |
GceAvdInfo :用于描述设备的 GceAvdInfo 。 |
options |
TestDeviceOptions :一个 TestDeviceOptions ,用于描述要为 GCE 设备使用的设备选项。 |
runUtil |
IRunUtil :用于执行命令的 IRunUtil 。 |
timeout |
long :提取完成所需的毫秒数 |
remoteFilePath |
String :用于查找文件的远程路径。 |
返回 |
File |
如果成功,则为拉取的文件;否则为 null |
fetchRemoteFile
public static boolean fetchRemoteFile (GceAvdInfo remoteInstance,
TestDeviceOptions options,
IRunUtil runUtil,
long timeout,
String remoteFilePath,
File localFile)
在设备或容器实例中提取远程文件。
参数 |
remoteInstance |
GceAvdInfo :用于描述设备的 GceAvdInfo 。 |
options |
TestDeviceOptions :一个 TestDeviceOptions ,用于描述要为 GCE 设备使用的设备选项。 |
runUtil |
IRunUtil :用于执行命令的 IRunUtil 。 |
timeout |
long :提取完成所需的毫秒数 |
remoteFilePath |
String :用于查找文件的远程路径。 |
localFile |
File :将拉取远程文件的本地 ERROR(/File) |
返回 |
boolean |
如果成功则返回 true,否则返回 false |
pushFileToRemote
public static boolean pushFileToRemote (GceAvdInfo remoteInstance,
TestDeviceOptions options,
scpArgs,
IRunUtil runUtil,
long timeout,
String remoteFilePath,
File localFile)
将 ERROR(/File)
从本地主机推送到远程实例
参数 |
remoteInstance |
GceAvdInfo :用于描述设备的 GceAvdInfo 。 |
options |
TestDeviceOptions :一个 TestDeviceOptions ,用于描述要为 GCE 设备使用的设备选项。 |
scpArgs |
:要传递给 scp 命令的额外参数 |
runUtil |
IRunUtil :用于执行命令的 IRunUtil 。 |
timeout |
long :提取完成所需的毫秒数 |
remoteFilePath |
String :用于查找文件的远程路径。 |
localFile |
File :将拉取远程文件的本地 ERROR(/File) |
返回 |
boolean |
如果成功则返回 true,否则返回 false |
本页面上的内容和代码示例受内容许可部分所述许可的限制。Java 和 OpenJDK 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-03-26。
[null,null,["最后更新时间 (UTC):2025-03-26。"],[],[]]