Starting March 27, 2025, we recommend using android-latest-release
instead of aosp-main
to build and contribute to AOSP. For more information, see Changes to AOSP.
Stay organized with collections
Save and categorize content based on your preferences.
RemoteFileUtil
public
class
RemoteFileUtil
extends Object
java.lang.Object
|
↳ |
com.android.tradefed.device.cloud.RemoteFileUtil
|
Utility class to handle file from a remote instance
Summary
Public methods |
static
boolean
|
doesRemoteFileExist(GceAvdInfo remoteInstance, TestDeviceOptions options, IRunUtil runUtil, long timeout, String remotePath)
Check if a file (or directory) exists on the remote instance
|
static
File
|
fetchRemoteDir(GceAvdInfo remoteInstance, TestDeviceOptions options, IRunUtil runUtil, long timeout, String remoteDirPath)
Fetch a remote directory from the remote host.
|
static
boolean
|
fetchRemoteDir(GceAvdInfo remoteInstance, TestDeviceOptions options, IRunUtil runUtil, long timeout, String remoteDirPath, File localDir)
Fetch a remote directory from the remote host.
|
static
File
|
fetchRemoteFile(GceAvdInfo remoteInstance, TestDeviceOptions options, IRunUtil runUtil, long timeout, String remoteFilePath)
Fetch a remote file in the container instance.
|
static
boolean
|
fetchRemoteFile(GceAvdInfo remoteInstance, TestDeviceOptions options, IRunUtil runUtil, long timeout, String remoteFilePath, File localFile)
Fetch a remote file in the device or container instance.
|
static
boolean
|
pushFileToRemote(GceAvdInfo remoteInstance, TestDeviceOptions options, scpArgs, IRunUtil runUtil, long timeout, String remoteFilePath, File localFile)
Push a ERROR(/File) from the local host to the remote instance
|
Public constructors
RemoteFileUtil
public RemoteFileUtil ()
Public methods
doesRemoteFileExist
public static boolean doesRemoteFileExist (GceAvdInfo remoteInstance,
TestDeviceOptions options,
IRunUtil runUtil,
long timeout,
String remotePath)
Check if a file (or directory) exists on the remote instance
Parameters |
remoteInstance |
GceAvdInfo : The GceAvdInfo that describe the device. |
options |
TestDeviceOptions : a TestDeviceOptions describing the device options to be used for the
GCE device. |
runUtil |
IRunUtil : a IRunUtil to execute commands. |
timeout |
long : in millisecond for the fetch to complete |
remotePath |
String : The remote path where to find the file. |
Returns |
boolean |
whether the file exists or not |
fetchRemoteDir
public static File fetchRemoteDir (GceAvdInfo remoteInstance,
TestDeviceOptions options,
IRunUtil runUtil,
long timeout,
String remoteDirPath)
Fetch a remote directory from the remote host.
Parameters |
remoteInstance |
GceAvdInfo : The GceAvdInfo that describe the device. |
options |
TestDeviceOptions : a TestDeviceOptions describing the device options to be used for the
GCE device. |
runUtil |
IRunUtil : a IRunUtil to execute commands. |
timeout |
long : in millisecond for the fetch to complete |
remoteDirPath |
String : The remote path where to find the directory. |
Returns |
File |
The pulled directory ERROR(/File) if successful, null otherwise |
fetchRemoteDir
public static boolean fetchRemoteDir (GceAvdInfo remoteInstance,
TestDeviceOptions options,
IRunUtil runUtil,
long timeout,
String remoteDirPath,
File localDir)
Fetch a remote directory from the remote host.
Parameters |
remoteInstance |
GceAvdInfo : The GceAvdInfo that describe the device. |
options |
TestDeviceOptions : a TestDeviceOptions describing the device options to be used for the
GCE device. |
runUtil |
IRunUtil : a IRunUtil to execute commands. |
timeout |
long : in millisecond for the fetch to complete |
remoteDirPath |
String : The remote path where to find the directory. |
localDir |
File : The local directory where to put the pulled files. |
Returns |
boolean |
True if successful, False otherwise |
fetchRemoteFile
public static File fetchRemoteFile (GceAvdInfo remoteInstance,
TestDeviceOptions options,
IRunUtil runUtil,
long timeout,
String remoteFilePath)
Fetch a remote file in the container instance.
Parameters |
remoteInstance |
GceAvdInfo : The GceAvdInfo that describe the device. |
options |
TestDeviceOptions : a TestDeviceOptions describing the device options to be used for the
GCE device. |
runUtil |
IRunUtil : a IRunUtil to execute commands. |
timeout |
long : in millisecond for the fetch to complete |
remoteFilePath |
String : The remote path where to find the file. |
Returns |
File |
The pulled filed if successful, null otherwise |
fetchRemoteFile
public static boolean fetchRemoteFile (GceAvdInfo remoteInstance,
TestDeviceOptions options,
IRunUtil runUtil,
long timeout,
String remoteFilePath,
File localFile)
Fetch a remote file in the device or container instance.
Parameters |
remoteInstance |
GceAvdInfo : The GceAvdInfo that describe the device. |
options |
TestDeviceOptions : a TestDeviceOptions describing the device options to be used for the
GCE device. |
runUtil |
IRunUtil : a IRunUtil to execute commands. |
timeout |
long : in millisecond for the fetch to complete |
remoteFilePath |
String : The remote path where to find the file. |
localFile |
File : The local ERROR(/File) where the remote file will be pulled |
Returns |
boolean |
True if successful, False otherwise |
pushFileToRemote
public static boolean pushFileToRemote (GceAvdInfo remoteInstance,
TestDeviceOptions options,
scpArgs,
IRunUtil runUtil,
long timeout,
String remoteFilePath,
File localFile)
Push a ERROR(/File)
from the local host to the remote instance
Parameters |
remoteInstance |
GceAvdInfo : The GceAvdInfo that describe the device. |
options |
TestDeviceOptions : a TestDeviceOptions describing the device options to be used for the
GCE device. |
scpArgs |
: extra args to be passed to the scp command |
runUtil |
IRunUtil : a IRunUtil to execute commands. |
timeout |
long : in millisecond for the fetch to complete |
remoteFilePath |
String : The remote path where to find the file. |
localFile |
File : The local ERROR(/File) where the remote file will be pulled |
Returns |
boolean |
True if successful, False otherwise |
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2023-03-08 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2023-03-08 UTC."],[],[]]