嵌套類 |
---|
class | GCSBucketUtil.GCSFileMetadata GCS 中文件信息的簡單包裝器。 |
公共構造函數
GCSBucketUtil
public GCSBucketUtil (String bucketName)
公共方法
複製
public CommandResult copy (String source,
String dest)
將文件或目錄複製到存儲桶或從存儲桶複製文件或目錄。
參數 |
---|
source | String : 源文件或模式 |
dest | String :目標文件或模式 |
獲取嘗試次數
public int getAttempts ()
getBotoConfig
public String getBotoConfig ()
獲取BotoPath
public String getBotoPath ()
獲取桶名
public String getBucketName ()
得到無障礙
public boolean getNoClobber ()
獲得平行
public boolean getParallel ()
get遞歸
public boolean getRecursive ()
獲取重試間隔
public long getRetryInterval ()
超時
public long getTimeout ()
是文件
public boolean isFile (String path)
檢查 GCS 文件是文件還是不是文件(文件夾)。
如果文件名以“/”結尾,那麼它就是一個文件夾。 gsutil ls gs://filename 應該返回 gs://filename 如果它是一個文件。如果文件夾中有文件,gsutil ls gs://文件夾名稱應該返回文件夾中的文件。如果文件夾中沒有文件,它將返回 gs://folder/ 。
參數 |
---|
path | String : 相對於桶的路徑.. |
ls
public ls (Path bucketPath)
列出 GCS 路徑下的文件。
參數 |
---|
bucketPath | Path :GCS 路徑 |
md5哈希
public String md5Hash (File localFile)
計算本地文件的 md5 哈希值。
拉
public CommandResult pull (Path bucketPath,
File localFile)
從 GCS 存儲桶下載文件或目錄。
參數 |
---|
bucketPath | Path : GCS bucket中的文件路徑 |
localFile | File :本地目標路徑 |
拉
public CommandResult pull (Path bucketPath)
將文件或目錄從 GCS 存儲桶下載到當前目錄。
參數 |
---|
bucketPath | Path : GCS bucket中的文件路徑 |
拉內容
public String pullContents (Path bucketPath)
從 GCS 存儲桶下載文件並提取其內容。
參數 |
---|
bucketPath | Path : GCS bucket中的文件路徑 |
推
public CommandResult push (File localFile)
將本地文件或目錄上傳到 GCS 存儲桶。
參數 |
---|
localFile | File : 本地文件或目錄 |
推
public CommandResult push (File localFile,
Path bucketPath)
將本地文件或目錄上傳到具有特定路徑的 GCS 存儲桶。
參數 |
---|
localFile | File : 本地文件或目錄 |
bucketPath | Path : GCS bucket中的文件路徑 |
推送字符串
public CommandResult pushString (String contents,
Path bucketPath)
將字符串上傳到 GCS 存儲桶。
參數 |
---|
contents | String :文件內容,作為字符串 |
bucketPath | Path : GCS bucket中的文件路徑 |
消除
public CommandResult remove (String pattern,
boolean force)
從存儲桶中刪除文件或目錄。
參數 |
---|
pattern | String :要刪除的文件、目錄或模式。 |
force | boolean : 是否忽略失敗並靜默繼續(不會拋出) |
消除
public CommandResult remove (Path path,
boolean force)
從存儲桶中刪除文件或目錄。
參數 |
---|
path | Path :要刪除的路徑 |
force | boolean : 文件不存在是否失敗 |
消除
public CommandResult remove (String pattern)
從存儲桶中刪除文件或目錄。
參數 |
---|
pattern | String :要刪除的文件、目錄或模式。 |
設置嘗試次數
public void setAttempts (int attempts)
設置BotoConfig
public void setBotoConfig (String botoConfig)
設置BotoPath
public void setBotoPath (String botoPath)
設置桶名
public void setBucketName (String bucketName)
設置NoClobber
public void setNoClobber (boolean noClobber)
設置平行
public void setParallel (boolean parallel)
設置遞歸
public void setRecursive (boolean recursive)
設置重試間隔
public void setRetryInterval (long retryInterval)
設置超時
public void setTimeout (long timeout,
TimeUnit unit)
參數 |
---|
timeout | long |
unit | TimeUnit |
設置超時時間
public void setTimeoutMs (long timeout)
受保護的方法
getRunUtil
protected IRunUtil getRunUtil ()
這個頁面中的內容和程式碼範例均受《內容授權》中的授權所規範。Java 與 OpenJDK 是 Oracle 和/或其關係企業的商標或註冊商標。
上次更新時間:2023-03-30 (世界標準時間)。
[{
"type": "thumb-down",
"id": "missingTheInformationINeed",
"label":"缺少我需要的資訊"
},{
"type": "thumb-down",
"id": "tooComplicatedTooManySteps",
"label":"過於複雜/步驟過多"
},{
"type": "thumb-down",
"id": "outOfDate",
"label":"過時"
},{
"type": "thumb-down",
"id": "translationIssue",
"label":"翻譯問題"
},{
"type": "thumb-down",
"id": "samplesCodeIssue",
"label":"示例/程式碼問題"
},{
"type": "thumb-down",
"id": "otherDown",
"label":"其他"
}]
[{
"type": "thumb-up",
"id": "easyToUnderstand",
"label":"容易理解"
},{
"type": "thumb-up",
"id": "solvedMyProblem",
"label":"確實解決了我的問題"
},{
"type": "thumb-up",
"id": "otherUp",
"label":"其他"
}]