GCSFileDownloaderBase

public class GCSFileDownloaderBase
extends GCSCommon

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


Google Cloud Storage (GCS)에서 파일을 다운로드하는 파일 다운로더

요약

상수

String GCS_APPROX_PREFIX

String GCS_PREFIX

필드

protected Boolean mCreateEmptyFile

공개 생성자

GCSFileDownloaderBase()
GCSFileDownloaderBase(Boolean createEmptyFile)

공개 메서드

static File createTempFileForRemote(String remoteFilePath, File rootDir)

지정된 경로로 다운로드된 파일을 저장하기 위해 임시 디스크에 고유한 파일을 만듭니다.

InputStream downloadFile(String bucketName, String filename)

GCS 버킷 파일에서 파일을 다운로드합니다.

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

지정된 파일 이름이 폴더인지 확인합니다.

String sanitizeDirectoryName(String name)

보호된 메서드

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)

상수

GCS_APPROX_PREFIX

public static final String GCS_APPROX_PREFIX

상수 값: "gs:/"

GCS_PREFIX

public static final String GCS_PREFIX

상수 값: "gs://"

필드

mCreateEmptyFile

protected Boolean mCreateEmptyFile

공개 생성자

GCSFileDownloaderBase

public GCSFileDownloaderBase ()

GCSFileDownloaderBase

public GCSFileDownloaderBase (Boolean createEmptyFile)

매개변수
createEmptyFile Boolean

공개 메서드

createTempFileForRemote

public static File createTempFileForRemote (String remoteFilePath, 
                File rootDir)

지정된 경로로 다운로드된 파일을 저장하기 위해 임시 디스크에 고유한 파일을 만듭니다.

경로의 기본 파일 이름을 기반으로 파일 이름을 생성합니다.

매개변수
remoteFilePath String: 이름을 구성할 원격 경로

rootDir File

반환 값
File

downloadFile

public InputStream downloadFile (String bucketName, 
                String filename)

GCS 버킷 파일에서 파일을 다운로드합니다.

매개변수
bucketName String: GCS 버킷 이름

filename String: 파일 이름

반환 값
InputStream ERROR(/InputStream)을 파일 콘텐츠로 바꿉니다.

downloadFile

public void downloadFile (String remotePath, 
                File destFile)

매개변수
remotePath String

destFile File

downloadFile

public File downloadFile (String remoteFilePath)

매개변수
remoteFilePath String

반환 값
File

getRemoteFileMetaData

public StorageObject getRemoteFileMetaData (String bucketName, 
                String remoteFilename)

매개변수
bucketName String

remoteFilename String

반환 값
StorageObject

isRemoteFolder

public boolean isRemoteFolder (String bucketName, 
                String filename)

지정된 파일 이름이 폴더인지 확인합니다.

GCS에는 두 가지 유형의 폴더가 있습니다. 1. UI에서 명시적으로 생성되었습니다. 폴더는 크기가 0인 텍스트 파일입니다 (객체임). 2. 파일을 업로드하면 모든 상위 폴더가 생성되지만 이러한 폴더는 GCS에 존재하지 않습니다 (객체가 아님). 이 함수는 두 경우 모두에 적용됩니다. 하지만 크기가 0인 폴더는 다운로드하지 않아야 합니다.

매개변수
bucketName String: GCS 버킷 이름입니다.

filename String: 버킷의 상대 경로입니다.

반환 값
boolean 파일 이름이 폴더이면 true이고, 그렇지 않으면 false입니다.

sanitizeDirectoryName

public String sanitizeDirectoryName (String name)

매개변수
name String

반환 값
String

보호된 메서드

createTempFile

protected File createTempFile (String remoteFilePath, 
                File rootDir)

매개변수
remoteFilePath String

rootDir File

반환 값
File

downloadFile

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

매개변수
bucketName String

remoteFilename String

localFile File

getStorage

protected Storage getStorage ()

반환 값
Storage

listRemoteFilesUnderFolder

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

매개변수
bucketName String

folder String

subFiles

subFolders

parseGcsPath

protected String[] parseGcsPath (String remotePath)

매개변수
remotePath String

반환 값
String[]