嵌套类 |
---|
class | GCSBucketUtil.GCSFileMetadata GCS 中文件信息的简单包装。 |
公共构造函数
GCSBucketUtil
public GCSBucketUtil (String bucketName)
公共方法
复制
public CommandResult copy (String source,
String dest)
将文件或目录复制到存储桶或从存储桶复制文件或目录。
参数 |
---|
source | String : 源文件或模式 |
dest | String : 目标文件或模式 |
获取尝试
public int getAttempts ()
获取BotoConfig
public String getBotoConfig ()
获取BotoPath
public String getBotoPath ()
获取桶名
public String getBucketName ()
获取NoClobber
public boolean getNoClobber ()
获取并行
public boolean getParallel ()
递归获取
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 路径下的文件。
md5哈希值
public String md5Hash (File localFile)
计算本地文件的 md5 哈希值。
拉
public CommandResult pull (Path bucketPath,
File localFile)
从 GCS 存储桶下载文件或目录。
参数 |
---|
bucketPath | Path :GCS存储桶中的文件路径 |
localFile | File :本地目标路径 |
拉
public CommandResult pull (Path bucketPath)
将文件或目录从GCS存储桶下载到当前目录。
参数 |
---|
bucketPath | Path :GCS存储桶中的文件路径 |
拉取内容
public String pullContents (Path bucketPath)
从 GCS 存储桶下载文件并提取其内容。
参数 |
---|
bucketPath | Path :GCS存储桶中的文件路径 |
推
public CommandResult push (File localFile)
将本地文件或目录上传到GCS存储桶。
参数 |
---|
localFile | File :本地文件或目录 |
推
public CommandResult push (File localFile,
Path bucketPath)
将本地文件或目录上传到指定路径的GCS存储桶中。
参数 |
---|
localFile | File :本地文件或目录 |
bucketPath | Path :GCS存储桶中的文件路径 |
推串
public CommandResult pushString (String contents,
Path bucketPath)
将字符串上传到 GCS 存储桶。
参数 |
---|
contents | String :文件内容,作为字符串 |
bucketPath | Path :GCS存储桶中的文件路径 |
消除
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)
设置Bucket名称
public void setBucketName (String bucketName)
设置无破坏
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)
受保护的方法
本页面上的内容和代码示例受内容许可部分所述许可的限制。Java 和 OpenJDK 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2023-07-19。
[{
"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":"其他"
}]