ObjectOperations

class ObjectOperations(s3Client: S3Client, bucketNameResolver: (String) -> String)

对象操作 facade。

Constructors

Link copied to clipboard
constructor(s3Client: S3Client, bucketNameResolver: (String) -> String)

Functions

Link copied to clipboard
fun copy(request: CopyObjectRequest): CopyObjectResponse

复制对象。

fun copy(sourceBucketName: String, sourceKey: String, destinationBucketName: String, destinationKey: String): CopyObjectResponse

按桶和 key 复制对象。

Link copied to clipboard
fun delete(request: DeleteObjectRequest): DeleteObjectResponse
fun delete(bucketName: String, key: String): DeleteObjectResponse

删除对象。

Link copied to clipboard
fun get(request: GetObjectRequest): ResponseInputStream<GetObjectResponse>

透传原生 getObject 输入流。

fun get(bucketName: String, key: String): ResponseInputStream<GetObjectResponse>

下载为输入流。

Link copied to clipboard
fun getBytes(bucketName: String, key: String): ResponseBytes<GetObjectResponse>

下载为字节数组。

Link copied to clipboard
fun head(request: HeadObjectRequest): HeadObjectResponse
fun head(bucketName: String, key: String): HeadObjectResponse

查询对象元数据。

Link copied to clipboard
fun list(request: ListObjectsV2Request): ListObjectsV2Response

列举对象。

fun list(bucketName: String, prefix: String? = null): ListObjectsV2Response

按前缀列举对象。

Link copied to clipboard
fun put(request: PutObjectRequest, requestBody: RequestBody): PutObjectResponse

透传原生 putObject。

fun put(bucketName: String, key: String, content: ByteArray, contentType: String = "application/octet-stream"): PutObjectResponse

上传字节数组对象。

fun put(bucketName: String, key: String, stream: InputStream, contentLength: Long, contentType: String = "application/octet-stream"): PutObjectResponse

上传输入流对象。