GCSBucketUtil

public class GCSBucketUtil
extends Object

java.lang.Object
com.android.tradefed.util.GCSBucketUtil


Gestionnaire de fichiers pour télécharger et télécharger 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). Ceci est obsolète, veuillez utiliser GCSFileDownloader à la place.

Résumé

Classes imbriquées

class GCSBucketUtil.GCSFileMetadata

Wrapper simple pour les informations sur les fichiers dans GCS.

Constructeurs publics

GCSBucketUtil (String bucketName)

Méthodes publiques

CommandResult copy (String source, String dest)

Copiez un fichier ou un répertoire vers ou depuis le compartiment.

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 un fichier ou non un fichier (un dossier).

ls (Path bucketPath)

Répertoriez les fichiers sous un chemin GCS.

CommandResult makeBucket (String projectId)

Créez le compartiment GCS.

String md5Hash (File localFile)

Calculez le hachage md5 pour le fichier local.

CommandResult pull (Path bucketPath, File localFile)

Téléchargez un fichier ou un répertoire à partir d'un compartiment GCS.

CommandResult pull (Path bucketPath)

Téléchargez un fichier ou un répertoire d'un compartiment 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)

Téléchargez un fichier ou un répertoire local dans un bucket GCS.

CommandResult push (File localFile, Path bucketPath)

Téléchargez un fichier ou un répertoire local dans un bucket GCS avec un chemin spécifique.

CommandResult pushString (String contents, Path bucketPath)

Téléchargez 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 compartiment.

CommandResult remove (Path path)

Supprimez un fichier ou un répertoire du compartiment.

CommandResult remove (String pattern)

Supprimez un fichier ou un répertoire du compartiment.

CommandResult removeBucket ()

Supprimer le compartiment 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 GCS.

Méthodes protégées

IRunUtil getRunUtil ()

Constructeurs publics

GCSBucketUtil

public GCSBucketUtil (String bucketName)

Paramètres
bucketName String

Méthodes publiques

copie

public CommandResult copy (String source, 
                String dest)

Copiez un fichier ou un répertoire vers ou depuis le compartiment.

Paramètres
source String : Fichier source ou modèle

dest String : Fichier ou modèle de destination

Retour
CommandResult Résultat CommandResult de l’opération.

obtenir des tentatives

public int getAttempts ()

Retour
int

getBotoConfig

public String getBotoConfig ()

Retour
String

obtenirBotoPath

public String getBotoPath ()

Retour
String

getBucketName

public String getBucketName ()

Retour
String

getNoClobber

public boolean getNoClobber ()

Retour
boolean

obtenirParallèle

public boolean getParallel ()

Retour
boolean

getRécursif

public boolean getRecursive ()

Retour
boolean

getRetryInterval

public long getRetryInterval ()

Retour
long

getTimeout

public long getTimeout ()

Retour
long

estFichier

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 « / », alors c'est un dossier. gsutil ls gs://filename doit renvoyer le gs://filename s'il s'agit d'un fichier. gsutil ls gs://folder name doit renvoyer les fichiers du dossier s'il contient des fichiers. Et il renverra gs://folder/ s'il n'y a aucun fichier dans le dossier.

Paramètres
path String : le chemin relatif au bucket.

Retour
boolean c'est un fichier ou pas un fichier.

Jetés
IOException

ls

public  ls (Path bucketPath)

Répertoriez les fichiers sous un chemin GCS.

Paramètres
bucketPath Path : le chemin GCS

Retour
une liste de String s qui sont des fichiers sous le chemin GCS

Jetés
IOException

faireBucket

public CommandResult makeBucket (String projectId)

Créez le bucket GCS.

Paramètres
projectId String

Retour
CommandResult Résultat CommandResult de l’opération.

Jetés
IOException

md5Hash

public String md5Hash (File localFile)

Calculez le hachage md5 pour le fichier local.

Paramètres
localFile File : un fichier local

Retour
String le hachage md5 pour le fichier local.

Jetés
IOException

tirer

public CommandResult pull (Path bucketPath, 
                File localFile)

Téléchargez un fichier ou un répertoire à partir d'un compartiment GCS.

Paramètres
bucketPath Path : Chemin du fichier dans le bucket GCS

localFile File : Chemin de destination local

Retour
CommandResult Résultat CommandResult de l’opération.

tirer

public CommandResult pull (Path bucketPath)

Téléchargez un fichier ou un répertoire d'un compartiment GCS vers le répertoire actuel.

Paramètres
bucketPath Path : Chemin du fichier dans le bucket GCS

Retour
CommandResult Résultat CommandResult de l’opération.

pullContenu

public String pullContents (Path bucketPath)

Téléchargez un fichier à partir d'un bucket GCS et extrayez son contenu.

Paramètres
bucketPath Path : Chemin du fichier dans le bucket GCS

Retour
String Contenu de la chaîne du fichier

pousser

public CommandResult push (File localFile)

Téléchargez un fichier ou un répertoire local dans un bucket GCS.

Paramètres
localFile File : fichier ou répertoire local

Retour
CommandResult Résultat CommandResult de l’opération.

pousser

public CommandResult push (File localFile, 
                Path bucketPath)

Téléchargez un fichier ou un répertoire local dans un bucket GCS avec un chemin spécifique.

Paramètres
localFile File : fichier ou répertoire local

bucketPath Path : Chemin du fichier dans le bucket GCS

Retour
CommandResult Résultat CommandResult de l’opération.

chaîne push

public CommandResult pushString (String contents, 
                Path bucketPath)

Téléchargez une chaîne dans un bucket GCS.

Paramètres
contents String : Contenu du fichier, sous forme de chaîne

bucketPath Path : Chemin du fichier dans le bucket GCS

Retour
CommandResult Résultat CommandResult de l’opération.

retirer

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 : s'il faut ignorer les échecs et continuer en silence (ne lancera pas)

Retour
CommandResult

retirer

public CommandResult remove (Path path, 
                boolean force)

Supprimez un fichier ou un répertoire du bucket.

Paramètres
path Path : Chemin à supprimer

force boolean : s'il faut échouer si le fichier n'existe pas

Retour
CommandResult

retirer

public CommandResult remove (Path path)

Supprimez un fichier ou un répertoire du bucket.

Paramètres
path Path : Chemin à supprimer

Retour
CommandResult

retirer

public CommandResult remove (String pattern)

Supprimez un fichier ou un répertoire du compartiment.

Paramètres
pattern String : Fichier, répertoire ou modèle à supprimer.

Retour
CommandResult

supprimerBucket

public CommandResult removeBucket ()

Supprimer le compartiment GCS

Retour
CommandResult

Jetés
IOException

définir des tentatives

public void setAttempts (int attempts)

Paramètres
attempts int

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

définirParallèle

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)

Paramètres
timeout long

statistique

public GCSBucketUtil.GCSFileMetadata stat (Path bucketPath)

Obtenez l'état du fichier pour le chemin GCS.

Paramètres
bucketPath Path : le chemin GCS

Retour
GCSBucketUtil.GCSFileMetadata GCSFileMetadata pour le chemin GCS

Jetés
IOException

Méthodes protégées

getRunUtil

protected IRunUtil getRunUtil ()

Retour
IRunUtil