GCSBucketUtil
  public
  
  
  
  class
  GCSBucketUtil
  
    extends Object
  
  
  
  
  
  
| java.lang.Object | |
| ↳ | com.android.tradefed.util.GCSBucketUtil | 
Google Cloud Storage (GCS)에서 파일을 다운로드하고 업로드하는 파일 관리자
이 클래스는 테스트 범위 (예: IRemoteTest)를 사용합니다. 지원 중단되었습니다. 대신 GCSFileDownloader을 사용하세요.
요약
| 중첩된 클래스 | |
|---|---|
| 
        
        
        
        
        class | GCSBucketUtil.GCSFileMetadataGCS의 파일 정보를 위한 간단한 래퍼입니다. | 
| 공개 생성자 | |
|---|---|
| 
      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 파일이 파일인지 아니면 파일이 아닌지 (폴더) 확인합니다. | 
| 
        
        
        
        
        
         | 
      ls(Path bucketPath)
      GCS 경로 아래의 파일을 나열합니다. | 
| 
        
        
        
        
        
        CommandResult | 
      makeBucket(String projectId)
      GCS 버킷을 만듭니다. | 
| 
        
        
        
        
        
        String | 
      md5Hash(File localFile)
      로컬 파일의 md5 해시를 계산합니다. | 
| 
        
        
        
        
        
        CommandResult | 
      pull(Path bucketPath, File localFile)
      GCS 버킷에서 파일 또는 디렉터리를 다운로드합니다. | 
| 
        
        
        
        
        
        CommandResult | 
      pull(Path bucketPath)
      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(Path path)
      버킷에서 파일 또는 디렉터리를 삭제합니다. | 
| 
        
        
        
        
        
        CommandResult | 
      remove(Path path, boolean force)
      버킷에서 파일 또는 디렉터리를 삭제합니다. | 
| 
        
        
        
        
        
        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작업 결과입니다. | 
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 | 파일인지 아닌지 여부 | 
| 생성 값 | |
|---|---|
|  | IOException | 
ls
publicls (Path bucketPath) 
GCS 경로 아래의 파일을 나열합니다.
| 매개변수 | |
|---|---|
| bucketPath | Path: GCS 경로 | 
| 반환 값 | |
|---|---|
|  | GCS 경로 아래의 파일인 String목록 | 
| 생성 값 | |
|---|---|
|  | IOException | 
makeBucket
public CommandResult makeBucket (String projectId)
GCS 버킷을 만듭니다.
| 매개변수 | |
|---|---|
| projectId | String | 
| 반환 값 | |
|---|---|
| CommandResult | CommandResult작업 결과입니다. | 
| 생성 값 | |
|---|---|
|  | IOException | 
md5Hash
public String md5Hash (File localFile)
로컬 파일의 md5 해시를 계산합니다.
| 매개변수 | |
|---|---|
| localFile | File: 로컬 파일 | 
| 반환 값 | |
|---|---|
| String | 로컬 파일의 MD5 해시입니다. | 
| 생성 값 | |
|---|---|
|  | IOException | 
가져오기
public CommandResult pull (Path bucketPath, File localFile)
GCS 버킷에서 파일 또는 디렉터리를 다운로드합니다.
| 매개변수 | |
|---|---|
| bucketPath | Path: GCS 버킷의 파일 경로 | 
| localFile | File: 로컬 대상 경로 | 
| 반환 값 | |
|---|---|
| CommandResult | CommandResult작업 결과입니다. | 
가져오기
public CommandResult pull (Path bucketPath)
GCS 버킷에서 파일 또는 디렉터리를 현재 디렉터리로 다운로드합니다.
| 매개변수 | |
|---|---|
| bucketPath | Path: GCS 버킷의 파일 경로 | 
| 반환 값 | |
|---|---|
| CommandResult | CommandResult작업 결과입니다. | 
pullContents
public String pullContents (Path bucketPath)
GCS 버킷에서 파일을 다운로드하고 콘텐츠를 추출합니다.
| 매개변수 | |
|---|---|
| bucketPath | Path: GCS 버킷의 파일 경로 | 
| 반환 값 | |
|---|---|
| String | 파일의 문자열 콘텐츠 | 
push
public CommandResult push (File localFile)
GCS 버킷에 로컬 파일 또는 디렉터리를 업로드합니다.
| 매개변수 | |
|---|---|
| localFile | File: 로컬 파일 또는 디렉터리 | 
| 반환 값 | |
|---|---|
| CommandResult | CommandResult작업 결과입니다. | 
push
public CommandResult push (File localFile, Path bucketPath)
특정 경로를 사용하여 로컬 파일 또는 디렉터리를 GCS 버킷에 업로드합니다.
| 매개변수 | |
|---|---|
| localFile | File: 로컬 파일 또는 디렉터리 | 
| bucketPath | Path: GCS 버킷의 파일 경로 | 
| 반환 값 | |
|---|---|
| CommandResult | CommandResult작업 결과입니다. | 
pushString
public CommandResult pushString (String contents, Path bucketPath)
문자열을 GCS 버킷에 업로드합니다.
| 매개변수 | |
|---|---|
| contents | String: 파일 콘텐츠(문자열) | 
| bucketPath | Path: GCS 버킷의 파일 경로 | 
| 반환 값 | |
|---|---|
| CommandResult | CommandResult작업 결과입니다. | 
삭제
public CommandResult remove (Path path)
버킷에서 파일 또는 디렉터리를 삭제합니다.
| 매개변수 | |
|---|---|
| path | Path: 삭제할 경로 | 
| 반환 값 | |
|---|---|
| CommandResult | |
삭제
public CommandResult remove (Path path, boolean force)
버킷에서 파일 또는 디렉터리를 삭제합니다.
| 매개변수 | |
|---|---|
| path | Path: 삭제할 경로 | 
| force | boolean: 파일이 없으면 실패할지 여부 | 
| 반환 값 | |
|---|---|
| CommandResult | |
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 | GCSFileMetadata: GCS 경로 | 
| 생성 값 | |
|---|---|
|  | IOException | 
