GCSFileDownloaderBase

public class GCSFileDownloaderBase
extends GCSCommon

java.lang.Object
   ↳ com.android.tradefed.util.gcs.GCSCommon
     ↳ com.android.tradefed.util.gcs.GCSFileDownloaderBase


Narzędzie do pobierania plików z Google Cloud Storage (GCS).

Podsumowanie

Stałe

String GCS_APPROX_PREFIX

String GCS_PREFIX

Fieldsem

protected Boolean mCreateEmptyFile

Publiczne konstruktory

GCSFileDownloaderBase()
GCSFileDownloaderBase(Boolean createEmptyFile)

Metody publiczne

static File createTempFileForRemote(String remoteFilePath, File rootDir)

Tworzy unikalny plik na dysku tymczasowym, w którym będzie przechowywany pobrany plik o podanej ścieżce.

InputStream downloadFile(String bucketName, String filename)

Pobierz plik z pliku zasobnika GCS.

void downloadFile(String remotePath, File destFile)
File downloadFile(String remoteFilePath)
StorageObject getRemoteFileMetaData(String bucketName, String remoteFilename)
boolean isRemoteFolder(String bucketName, String filename)

Sprawdź, czy podana nazwa pliku jest folderem.

String sanitizeDirectoryName(String name)

Metody chronione

File createTempFile(String remoteFilePath, File rootDir)
void downloadFile(String bucketName, String remoteFilename, File localFile)
Storage getStorage()
void listRemoteFilesUnderFolder(String bucketName, String folder, subFiles, subFolders)
String[] parseGcsPath(String remotePath)

Stałe

GCS_APPROX_PREFIX

public static final String GCS_APPROX_PREFIX

Stała wartość: „gs:/”

GCS_PREFIX

public static final String GCS_PREFIX

Stała wartość: "gs://"

Fieldsem

mCreateEmptyFile

protected Boolean mCreateEmptyFile

Publiczne konstruktory

GCSFileDownloaderBase

public GCSFileDownloaderBase ()

GCSFileDownloaderBase

public GCSFileDownloaderBase (Boolean createEmptyFile)

Parametry
createEmptyFile Boolean

Metody publiczne

createTempFileForRemote

public static File createTempFileForRemote (String remoteFilePath, 
                File rootDir)

Tworzy unikalny plik na dysku tymczasowym, w którym będzie przechowywany pobrany plik o podanej ścieżce.

Tworzy nazwę pliku na podstawie podstawowej nazwy pliku ze ścieżki.

Parametry
remoteFilePath String: ścieżka zdalna, na podstawie której zostanie utworzona nazwa

rootDir File

Zwroty
File

downloadFile

public InputStream downloadFile (String bucketName, 
                String filename)

Pobierz plik z pliku zasobnika GCS.

Parametry
bucketName String: nazwa zasobnika GCS

filename String: nazwa pliku,

Zwroty
InputStream ERROR(/InputStream) z zawartością pliku.

downloadFile

public void downloadFile (String remotePath, 
                File destFile)

Parametry
remotePath String

destFile File

downloadFile

public File downloadFile (String remoteFilePath)

Parametry
remoteFilePath String

Zwroty
File

getRemoteFileMetaData

public StorageObject getRemoteFileMetaData (String bucketName, 
                String remoteFilename)

Parametry
bucketName String

remoteFilename String

Zwroty
StorageObject

isRemoteFolder

public boolean isRemoteFolder (String bucketName, 
                String filename)

Sprawdź, czy podana nazwa pliku jest folderem.

W GCS są 2 typy folderów: Utworzone bezpośrednio w interfejsie. Folder to plik tekstowy o rozmiarze 0 KB (jest to obiekt). 2. Gdy przesyłasz plik, tworzone są wszystkie jego foldery nadrzędne, ale te foldery nie istnieją (nie są obiektami) w GCS. Ta funkcja działa w obu przypadkach. But we should not try to download the size 0 folders.

Parametry
bucketName String: to nazwa zasobnika GCS.

filename String: to ścieżka względna do zasobnika.

Zwroty
boolean Wartość true, jeśli nazwa pliku jest folderem, w przeciwnym razie wartość false.

sanitizeDirectoryName

public String sanitizeDirectoryName (String name)

Parametry
name String

Zwroty
String

Metody chronione

createTempFile

protected File createTempFile (String remoteFilePath, 
                File rootDir)

Parametry
remoteFilePath String

rootDir File

Zwroty
File

downloadFile

protected void downloadFile (String bucketName, 
                String remoteFilename, 
                File localFile)

Parametry
bucketName String

remoteFilename String

localFile File

getStorage

protected Storage getStorage ()

Zwroty
Storage

listRemoteFilesUnderFolder

protected void listRemoteFilesUnderFolder (String bucketName, 
                String folder, 
                 subFiles, 
                 subFolders)

Parametry
bucketName String

folder String

subFiles

subFolders

parseGcsPath

protected String[] parseGcsPath (String remotePath)

Parametry
remotePath String

Zwroty
String[]