GCSBucketUtil
public
class
GCSBucketUtil
extends Object
| java.lang.Object | |
| ↳ | com.android.tradefed.util.GCSBucketUtil |
Google Cloud Storage (GCS)에서 파일을 다운로드하고 업로드하는 파일 관리자
이 클래스는 테스트 범위에서 사용하면 안 됩니다 (즉, IRemoteTest)를 구현해야 합니다. 이 정책은 지원 중단되었으므로 GCSFileDownloader 정책을 대신 사용하세요.
요약
중첩된 클래스 | |
|---|---|
class |
GCSBucketUtil.GCSFileMetadata
GCS의 파일 정보를 위한 간단한 래퍼입니다. |
공개 생성자 | |
|---|---|
GCSBucketUtil(String bucketName)
|
|
공개 메서드 | |
|---|---|
CommandResult
|
copy(String source, String dest)
버킷으로 또는 버킷에서 파일이나 디렉터리를 복사합니다. |
int
|
getAttempts()
|
String
|
getBotoConfig()
|
String
|
getBotoPath()
|
String
|
getBucketName()
|
boolean
|
getNoClobber()
|
boolean
|
getParallel()
|
boolean
|
getRecursive()
|
long
|
getRetryInterval()
|
long
|
getTimeout()
|
boolean
|
isFile(String path)
GCS 파일이 파일인지 폴더인지 확인합니다. |
List<String>
|
ls(Path bucketPath)
GCS 경로 아래의 파일을 나열합니다. |
CommandResult
|
makeBucket(String projectId)
GCS 버킷을 만듭니다. |
String
|
md5Hash(File localFile)
로컬 파일의 md5 해시를 계산합니다. |
CommandResult
|
pull(Path bucketPath)
GCS 버킷에서 현재 디렉터리로 파일 또는 디렉터리를 다운로드합니다. |
CommandResult
|
pull(Path bucketPath, File localFile)
GCS 버킷에서 파일 또는 디렉터리를 다운로드합니다. |
String
|
pullContents(Path bucketPath)
GCS 버킷에서 파일을 다운로드하고 콘텐츠를 추출합니다. |
CommandResult
|
push(File localFile)
로컬 파일 또는 디렉터리를 GCS 버킷에 업로드합니다. |
CommandResult
|
push(File localFile, Path bucketPath)
특정 경로를 사용하여 로컬 파일 또는 디렉터리를 GCS 버킷에 업로드합니다. |
CommandResult
|
pushString(String contents, Path bucketPath)
문자열을 GCS 버킷에 업로드합니다. |
CommandResult
|
remove(String pattern, boolean force)
버킷에서 파일 또는 디렉터리를 삭제합니다. |
CommandResult
|
remove(Path path, boolean force)
버킷에서 파일 또는 디렉터리를 삭제합니다. |
CommandResult
|
remove(Path path)
버킷에서 파일 또는 디렉터리를 삭제합니다. |
CommandResult
|
remove(String pattern)
버킷에서 파일 또는 디렉터리를 삭제합니다. |
CommandResult
|
removeBucket()
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)
GCS 경로의 파일 상태를 가져옵니다. |
보호된 메서드 | |
|---|---|
IRunUtil
|
getRunUtil()
|
공개 생성자
GCSBucketUtil
public GCSBucketUtil (String bucketName)
| 매개변수 | |
|---|---|
bucketName |
String |
공개 메서드
복사
public CommandResult copy (String source, String dest)
버킷으로 또는 버킷에서 파일이나 디렉터리를 복사합니다.
| 매개변수 | |
|---|---|
source |
String: 소스 파일 또는 패턴 |
dest |
String: 대상 파일 또는 패턴 |
| 반환 | |
|---|---|
CommandResult |
작업의 CommandResult 결과입니다. |
| 생성 값 | |
|---|---|
IOException |
|
getAttempts
public int getAttempts ()
| 반환 | |
|---|---|
int |
|
getBotoConfig
public String getBotoConfig ()
| 반환 | |
|---|---|
String |
|
getBotoPath
public String getBotoPath ()
| 반환 | |
|---|---|
String |
|
getBucketName
public String getBucketName ()
| 반환 | |
|---|---|
String |
|
getNoClobber
public boolean getNoClobber ()
| 반환 | |
|---|---|
boolean |
|
getParallel
public boolean getParallel ()
| 반환 | |
|---|---|
boolean |
|
getRecursive
public boolean getRecursive ()
| 반환 | |
|---|---|
boolean |
|
getRetryInterval
public long getRetryInterval ()
| 반환 | |
|---|---|
long |
|
getTimeout
public long getTimeout ()
| 반환 | |
|---|---|
long |
|
isFile
public boolean isFile (String path)
GCS 파일이 파일인지 폴더인지 확인합니다.
파일 이름이 '/'로 끝나면 폴더입니다. 파일인 경우 gsutil ls gs://filename은 gs://filename을 반환해야 합니다. 폴더에 파일이 있는 경우 gsutil ls gs://folder name은 폴더의 파일을 반환해야 합니다. 폴더에 파일이 없으면 gs://folder/ 를 반환합니다.
| 매개변수 | |
|---|---|
path |
String: 버킷을 기준으로 한 경로입니다. |
| 반환 | |
|---|---|
boolean |
파일인지 아닌지 |
| 생성 값 | |
|---|---|
|
java.io.IOException |
IOException |
|
ls
public List<String> ls (Path bucketPath)
GCS 경로 아래의 파일을 나열합니다.
| 매개변수 | |
|---|---|
bucketPath |
Path: GCS 경로 |
| 반환 | |
|---|---|
List<String> |
GCS 경로 아래에 있는 파일인 String 목록 |
| 생성 값 | |
|---|---|
|
java.io.IOException |
IOException |
|
makeBucket
public CommandResult makeBucket (String projectId)
GCS 버킷을 만듭니다.
| 매개변수 | |
|---|---|
projectId |
String |
| 반환 | |
|---|---|
CommandResult |
작업의 CommandResult 결과입니다. |
| 생성 값 | |
|---|---|
|
java.io.IOException |
IOException |
|
md5Hash
public String md5Hash (File localFile)
로컬 파일의 md5 해시를 계산합니다.
| 매개변수 | |
|---|---|
localFile |
File: 로컬 파일 |
| 반환 | |
|---|---|
String |
로컬 파일의 md5 해시입니다. |
| 생성 값 | |
|---|---|
|
java.io.IOException |
IOException |
|
가져오다
public CommandResult pull (Path bucketPath)
GCS 버킷에서 현재 디렉터리로 파일 또는 디렉터리를 다운로드합니다.
| 매개변수 | |
|---|---|
bucketPath |
Path: GCS 버킷의 파일 경로 |
| 반환 | |
|---|---|
CommandResult |
작업의 CommandResult 결과입니다. |
| 생성 값 | |
|---|---|
IOException |
|
가져오다
public CommandResult pull (Path bucketPath, File localFile)
GCS 버킷에서 파일 또는 디렉터리를 다운로드합니다.
| 매개변수 | |
|---|---|
bucketPath |
Path: GCS 버킷의 파일 경로 |
localFile |
File: 로컬 대상 경로 |
| 반환 | |
|---|---|
CommandResult |
작업의 CommandResult 결과입니다. |
| 생성 값 | |
|---|---|
IOException |
|
pullContents
public String pullContents (Path bucketPath)
GCS 버킷에서 파일을 다운로드하고 콘텐츠를 추출합니다.
| 매개변수 | |
|---|---|
bucketPath |
Path: GCS 버킷의 파일 경로 |
| 반환 | |
|---|---|
String |
파일의 문자열 콘텐츠 |
| 생성 값 | |
|---|---|
IOException |
|
푸시하다 : 내보내다
public CommandResult push (File localFile)
로컬 파일 또는 디렉터리를 GCS 버킷에 업로드합니다.
| 매개변수 | |
|---|---|
localFile |
File: 로컬 파일 또는 디렉터리 |
| 반환 | |
|---|---|
CommandResult |
작업의 CommandResult 결과입니다. |
| 생성 값 | |
|---|---|
IOException |
|
푸시하다 : 내보내다
public CommandResult push (File localFile, Path bucketPath)
특정 경로를 사용하여 로컬 파일 또는 디렉터리를 GCS 버킷에 업로드합니다.
| 매개변수 | |
|---|---|
localFile |
File: 로컬 파일 또는 디렉터리 |
bucketPath |
Path: GCS 버킷의 파일 경로 |
| 반환 | |
|---|---|
CommandResult |
작업의 CommandResult 결과입니다. |
| 생성 값 | |
|---|---|
IOException |
|
pushString
public CommandResult pushString (String contents, Path bucketPath)
문자열을 GCS 버킷에 업로드합니다.
| 매개변수 | |
|---|---|
contents |
String: 파일 콘텐츠(문자열) |
bucketPath |
Path: GCS 버킷의 파일 경로 |
| 반환 | |
|---|---|
CommandResult |
작업의 CommandResult 결과입니다. |
| 생성 값 | |
|---|---|
IOException |
|
삭제
public CommandResult remove (String pattern, boolean force)
버킷에서 파일 또는 디렉터리를 삭제합니다.
| 매개변수 | |
|---|---|
pattern |
String: 삭제할 파일, 디렉터리 또는 패턴입니다. |
force |
boolean: 오류를 무시하고 자동으로 계속할지 여부 (예외가 발생하지 않음) |
| 반환 | |
|---|---|
CommandResult |
|
| 생성 값 | |
|---|---|
IOException |
|
삭제
public CommandResult remove (Path path, boolean force)
버킷에서 파일 또는 디렉터리를 삭제합니다.
| 매개변수 | |
|---|---|
path |
Path: 삭제할 경로 |
force |
boolean: 파일이 없는 경우 실패할지 여부 |
| 반환 | |
|---|---|
CommandResult |
|
| 생성 값 | |
|---|---|
IOException |
|
삭제
public CommandResult remove (Path path)
버킷에서 파일 또는 디렉터리를 삭제합니다.
| 매개변수 | |
|---|---|
path |
Path: 삭제할 경로 |
| 반환 | |
|---|---|
CommandResult |
|
| 생성 값 | |
|---|---|
IOException |
|
삭제
public CommandResult remove (String pattern)
버킷에서 파일 또는 디렉터리를 삭제합니다.
| 매개변수 | |
|---|---|
pattern |
String: 삭제할 파일, 디렉터리 또는 패턴입니다. |
| 반환 | |
|---|---|
CommandResult |
|
| 생성 값 | |
|---|---|
IOException |
|
removeBucket
public CommandResult removeBucket ()
GCS 버킷 삭제
| 반환 | |
|---|---|
CommandResult |
|
| 생성 값 | |
|---|---|
|
java.io.IOException |
IOException |
|
setAttempts
public void setAttempts (int attempts)
| 매개변수 | |
|---|---|
attempts |
int |
setBotoConfig
public void setBotoConfig (String botoConfig)
| 매개변수 | |
|---|---|
botoConfig |
String |
setBotoPath
public void setBotoPath (String botoPath)
| 매개변수 | |
|---|---|
botoPath |
String |
setBucketName
public void setBucketName (String bucketName)
| 매개변수 | |
|---|---|
bucketName |
String |
setNoClobber
public void setNoClobber (boolean noClobber)
| 매개변수 | |
|---|---|
noClobber |
boolean |
setParallel
public void setParallel (boolean parallel)
| 매개변수 | |
|---|---|
parallel |
boolean |
setRecursive
public void setRecursive (boolean recursive)
| 매개변수 | |
|---|---|
recursive |
boolean |
setRetryInterval
public void setRetryInterval (long retryInterval)
| 매개변수 | |
|---|---|
retryInterval |
long |
setTimeout
public void setTimeout (long timeout,
TimeUnit unit)| 매개변수 | |
|---|---|
timeout |
long |
unit |
TimeUnit |
setTimeoutMs
public void setTimeoutMs (long timeout)
| 매개변수 | |
|---|---|
timeout |
long |
stat
public GCSBucketUtil.GCSFileMetadata stat (Path bucketPath)
GCS 경로의 파일 상태를 가져옵니다.
| 매개변수 | |
|---|---|
bucketPath |
Path: GCS 경로 |
| 반환 | |
|---|---|
GCSBucketUtil.GCSFileMetadata |
GCS 경로의 GCSFileMetadata |
| 생성 값 | |
|---|---|
|
java.io.IOException |
IOException |
|