À partir du 27 mars 2025, nous vous recommandons d'utiliser android-latest-release
au lieu de aosp-main
pour créer et contribuer à AOSP. Pour en savoir plus, consultez la section Modifications apportées à AOSP.
Restez organisé à l'aide des collections
Enregistrez et classez les contenus selon vos préférences.
GCSBucketUtil
public
class
GCSBucketUtil
extends Object
java.lang.Object
|
↳ |
com.android.tradefed.util.GCSBucketUtil
|
Gestionnaire de fichiers permettant de télécharger et d'importer des fichiers depuis Google Cloud Storage (GCS).
Cette classe ne doit PAS être utilisée dans le cadre d'un test (c'est-à-dire, IRemoteTest). Cette option est obsolète. Veuillez utiliser GCSFileDownloader
à la place.
Résumé
Méthodes publiques |
CommandResult
|
copy(String source, String dest)
Copiez un fichier ou un répertoire vers ou depuis le bucket.
|
int
|
getAttempts()
|
String
|
getBotoConfig()
|
String
|
getBotoPath()
|
String
|
getBucketName()
|
boolean
|
getNoClobber()
|
boolean
|
getParallel()
|
boolean
|
getRecursive()
|
long
|
getRetryInterval()
|
long
|
getTimeout()
|
boolean
|
isFile(String path)
Vérifier si un fichier GCS est un fichier ou non (un dossier)
|
|
ls(Path bucketPath)
Répertoriez les fichiers sous un chemin d'accès GCS.
|
CommandResult
|
makeBucket(String projectId)
Créez le bucket GCS.
|
String
|
md5Hash(File localFile)
Calculez le hachage MD5 du fichier local.
|
CommandResult
|
pull(Path bucketPath, File localFile)
Téléchargez un fichier ou un répertoire à partir d'un bucket GCS.
|
CommandResult
|
pull(Path bucketPath)
Téléchargez un fichier ou un répertoire à partir d'un bucket GCS vers le répertoire actuel.
|
String
|
pullContents(Path bucketPath)
Téléchargez un fichier à partir d'un bucket GCS et extrayez son contenu.
|
CommandResult
|
push(File localFile)
Importez un fichier ou un répertoire local dans un bucket GCS.
|
CommandResult
|
push(File localFile, Path bucketPath)
Importez un fichier ou un répertoire local dans un bucket GCS avec un chemin d'accès spécifique.
|
CommandResult
|
pushString(String contents, Path bucketPath)
Importez une chaîne dans un bucket GCS.
|
CommandResult
|
remove(String pattern, boolean force)
Supprimez un fichier ou un répertoire du bucket.
|
CommandResult
|
remove(Path path, boolean force)
Supprimez un fichier ou un répertoire du bucket.
|
CommandResult
|
remove(Path path)
Supprimez un fichier ou un répertoire du bucket.
|
CommandResult
|
remove(String pattern)
Supprimez un fichier ou un répertoire du bucket.
|
CommandResult
|
removeBucket()
Supprimer le bucket GCS
|
void
|
setAttempts(int attempts)
|
void
|
setBotoConfig(String botoConfig)
|
void
|
setBotoPath(String botoPath)
|
void
|
setBucketName(String bucketName)
|
void
|
setNoClobber(boolean noClobber)
|
void
|
setParallel(boolean parallel)
|
void
|
setRecursive(boolean recursive)
|
void
|
setRetryInterval(long retryInterval)
|
void
|
setTimeout(long timeout, TimeUnit unit)
|
void
|
setTimeoutMs(long timeout)
|
GCSBucketUtil.GCSFileMetadata
|
stat(Path bucketPath)
Obtenez l'état du fichier pour le chemin d'accès GCS.
|
Constructeurs publics
GCSBucketUtil
public GCSBucketUtil (String bucketName)
Paramètres |
bucketName |
String |
Méthodes publiques
copier
public CommandResult copy (String source,
String dest)
Copiez un fichier ou un répertoire vers ou depuis le bucket.
Paramètres |
source |
String : fichier source ou modèle |
dest |
String : fichier ou modèle de destination |
getAttempts
public int getAttempts ()
getBotoConfig
public String getBotoConfig ()
getBotoPath
public String getBotoPath ()
getBucketName
public String getBucketName ()
getNoClobber
public boolean getNoClobber ()
getParallel
public boolean getParallel ()
getRecursive
public boolean getRecursive ()
getRetryInterval
public long getRetryInterval ()
getTimeout
public long getTimeout ()
isFile
public boolean isFile (String path)
Vérifier si un fichier GCS est un fichier ou non (un dossier)
Si le nom de fichier se termine par "/", il s'agit d'un dossier. gsutil ls gs://nom_fichier doit renvoyer le nom du fichier gs://si c'est un fichier. gsutil ls gs://nom_dossier doit renvoyer les fichiers du dossier s'il y en a. Il renverra gs://folder/ si aucun fichier ne se trouve dans le dossier.
Paramètres |
path |
String : chemin d'accès relatif au bucket. |
Renvoie |
boolean |
s'il s'agit d'un fichier ou non. |
ls
public ls (Path bucketPath)
Répertoriez les fichiers sous un chemin d'accès GCS.
Paramètres |
bucketPath |
Path : chemin d'accès GCS |
Renvoie |
|
une liste de String qui sont des fichiers sous le chemin d'accès GCS |
makeBucket
public CommandResult makeBucket (String projectId)
Créez le bucket GCS.
Paramètres |
projectId |
String |
md5Hash
public String md5Hash (File localFile)
Calculez le hachage MD5 du fichier local.
Paramètres |
localFile |
File : fichier local |
Renvoie |
String |
le hachage MD5 du fichier local. |
pull
public CommandResult pull (Path bucketPath,
File localFile)
Téléchargez un fichier ou un répertoire à partir d'un bucket GCS.
Paramètres |
bucketPath |
Path : chemin d'accès au fichier dans le bucket GCS |
localFile |
File : chemin d'accès à la destination locale |
tirer
public CommandResult pull (Path bucketPath)
Téléchargez un fichier ou un répertoire à partir d'un bucket GCS vers le répertoire actuel.
Paramètres |
bucketPath |
Path : chemin d'accès au fichier dans le bucket GCS |
pullContents
public String pullContents (Path bucketPath)
Téléchargez un fichier à partir d'un bucket GCS, puis extrayez son contenu.
Paramètres |
bucketPath |
Path : chemin d'accès au fichier dans le bucket GCS |
Renvoie |
String |
Contenu de la chaîne du fichier
|
push
public CommandResult push (File localFile)
Importez un fichier ou un répertoire local dans un bucket GCS.
Paramètres |
localFile |
File : fichier ou répertoire local |
push
public CommandResult push (File localFile,
Path bucketPath)
Importez un fichier ou un répertoire local dans un bucket GCS avec un chemin d'accès spécifique.
Paramètres |
localFile |
File : fichier ou répertoire local |
bucketPath |
Path : chemin d'accès au fichier dans le bucket GCS |
pushString
public CommandResult pushString (String contents,
Path bucketPath)
Importez une chaîne dans un bucket GCS.
Paramètres |
contents |
String : contenu du fichier, sous forme de chaîne |
bucketPath |
Path : chemin d'accès au fichier dans le bucket GCS |
supprimer
public CommandResult remove (String pattern,
boolean force)
Supprimez un fichier ou un répertoire du bucket.
Paramètres |
pattern |
String : fichier, répertoire ou modèle à supprimer. |
force |
boolean : indique si les échecs doivent être ignorés et la poursuite de l'opération en mode silencieux (aucune exception ne sera générée)
|
supprimer
public CommandResult remove (Path path,
boolean force)
Supprimez un fichier ou un répertoire du bucket.
Paramètres |
path |
Path : chemin d'accès à supprimer |
force |
boolean : indique si l'opération doit échouer si le fichier n'existe pas.
|
supprimer
public CommandResult remove (Path path)
Supprimez un fichier ou un répertoire du bucket.
Paramètres |
path |
Path : chemin d'accès à supprimer
|
supprimer
public CommandResult remove (String pattern)
Supprimez un fichier ou un répertoire du bucket.
Paramètres |
pattern |
String : fichier, répertoire ou modèle à supprimer.
|
removeBucket
public CommandResult removeBucket ()
Supprimer le bucket GCS
setAttempts
public void setAttempts (int attempts)
setBotoConfig
public void setBotoConfig (String botoConfig)
Paramètres |
botoConfig |
String |
setBotoPath
public void setBotoPath (String botoPath)
Paramètres |
botoPath |
String |
setBucketName
public void setBucketName (String bucketName)
Paramètres |
bucketName |
String |
setNoClobber
public void setNoClobber (boolean noClobber)
Paramètres |
noClobber |
boolean |
setParallel
public void setParallel (boolean parallel)
Paramètres |
parallel |
boolean |
setRecursive
public void setRecursive (boolean recursive)
Paramètres |
recursive |
boolean |
setRetryInterval
public void setRetryInterval (long retryInterval)
Paramètres |
retryInterval |
long |
setTimeout
public void setTimeout (long timeout,
TimeUnit unit)
Paramètres |
timeout |
long |
unit |
TimeUnit |
setTimeoutMs
public void setTimeoutMs (long timeout)
stat
public GCSBucketUtil.GCSFileMetadata stat (Path bucketPath)
Obtenez l'état du fichier pour le chemin d'accès GCS.
Paramètres |
bucketPath |
Path : chemin d'accès GCS |
Méthodes protégées
getRunUtil
protected IRunUtil getRunUtil ()
Le contenu et les exemples de code de cette page sont soumis aux licences décrites dans la Licence de contenu. Java et OpenJDK sont des marques ou des marques déposées d'Oracle et/ou de ses sociétés affiliées.
Dernière mise à jour le 2025/03/26 (UTC).
[[["Facile à comprendre","easyToUnderstand","thumb-up"],["J'ai pu résoudre mon problème","solvedMyProblem","thumb-up"],["Autre","otherUp","thumb-up"]],[["Il n'y a pas l'information dont j'ai besoin","missingTheInformationINeed","thumb-down"],["Trop compliqué/Trop d'étapes","tooComplicatedTooManySteps","thumb-down"],["Obsolète","outOfDate","thumb-down"],["Problème de traduction","translationIssue","thumb-down"],["Mauvais exemple/Erreur de code","samplesCodeIssue","thumb-down"],["Autre","otherDown","thumb-down"]],["Dernière mise à jour le 2025/03/26 (UTC)."],[],[]]