Restez organisé à l'aide des collections
Enregistrez et classez les contenus selon vos préférences.
UtilitaireGCSBucket
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 à partir de Google Cloud Storage (GCS)
Cette classe NE doit PAS être utilisée dans le cadre d'un test (par exemple, IRemoteTest). C'est
obsolète, veuillez utiliser GCSFileDownloader
à la place.
Résumé
Méthodes publiques |
CommandResult
|
copy(String source, String dest)
Copier un fichier ou un répertoire depuis ou vers 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érifiez qu'un fichier GCS est bien un fichier ou non un fichier (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 d'un bucket GCS vers le répertoire actuel.
|
String
|
pullContents(Path bucketPath)
Téléchargez un fichier à partir d'un bucket GCS, puis 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)
importer 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 correspondant au chemin d'accès GCS.
|
Constructeurs publics
UtilitaireGCSBucket
public GCSBucketUtil (String bucketName)
Paramètres |
bucketName |
String |
Méthodes publiques
copier
public CommandResult copy (String source,
String dest)
Copier un fichier ou un répertoire depuis ou vers le bucket
Paramètres |
source |
String : fichier ou format source |
dest |
String : fichier ou format de destination |
getTentatives
public int getAttempts ()
getBotoConfig
public String getBotoConfig ()
getBotoPath
public String getBotoPath ()
NomDuBucket
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érifiez qu'un fichier GCS est un fichier ou non un fichier (un dossier).
Si le nom du fichier se termine par "/", il s'agit d'un dossier. La commande "gsutil ls gs://filename" doit renvoyer
gs://filename s'il s'agit d'un fichier. gsutil ls gs://nom du dossier doit renvoyer les fichiers du dossier
s'il contient des fichiers. S'il n'y a pas de fichier, il renvoie gs://folder/.
dans le dossier.
Paramètres |
path |
String : chemin d'accès relatif au bucket. |
Renvoie |
boolean |
il s'agit d'un fichier
ou pas d'un fichier. |
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 : un fichier local |
Renvoie |
String |
le hachage md5 pour
le fichier local. |
extraire
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 de destination local |
extraire
public CommandResult pull (Path bucketPath)
Téléchargez un fichier ou un répertoire 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 des chaînes 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)
importer 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 silencieuse (qui ne sera pas 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 le fichier 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.
|
Supprimer l'ensemble
public CommandResult removeBucket ()
Supprimer le bucket GCS
setTentatives
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 |
DéfinirNomDuBucket
public void setBucketName (String bucketName)
Paramètres |
bucketName |
String |
DéfinirNoClobber
public void setNoClobber (boolean noClobber)
Paramètres |
noClobber |
boolean |
setParallel
public void setParallel (boolean parallel)
Paramètres |
parallel |
boolean |
setRécursif
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)
statistiques
public GCSBucketUtil.GCSFileMetadata stat (Path bucketPath)
Obtenez l'état du fichier correspondant au 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 2024/08/23 (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 2024/08/23 (UTC)."],[],[]]