Class GoogleCloudStorageImpl
- java.lang.Object
-
- com.google.cloud.hadoop.gcsio.GoogleCloudStorageImpl
-
- All Implemented Interfaces:
GoogleCloudStorage
public class GoogleCloudStorageImpl extends Object implements GoogleCloudStorage
Provides read/write access to Google Cloud Storage (GCS), using Java nio channel semantics. This is a basic implementation of the GoogleCloudStorage interface that mostly delegates through to the appropriate API call(s) via the generated JSON API client, while adding reliability and performance features such as setting up low-level retries, translating low-level exceptions, and request batching.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceGoogleCloudStorageImpl.BackOffFactoryA factory for producing BackOff objects.static classGoogleCloudStorageImpl.Builder-
Nested classes/interfaces inherited from interface com.google.cloud.hadoop.gcsio.GoogleCloudStorage
GoogleCloudStorage.ListPage<T>
-
-
Field Summary
-
Fields inherited from interface com.google.cloud.hadoop.gcsio.GoogleCloudStorage
LIST_MAX_RESULTS, MAX_COMPOSE_OBJECTS, MAX_RESULTS_UNLIMITED, PATH_DELIMITER
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static GoogleCloudStorageImpl.Builderbuilder()voidclose()SeeGoogleCloudStorage.close()for details about expected behavior.voidcompose(String bucketName, List<String> sources, String destination, String contentType)Composes inputs into a single GCS object.GoogleCloudStorageItemInfocomposeObjects(List<StorageResourceId> sources, StorageResourceId destination, CreateObjectOptions options)Composes inputs into a single GCS object.voidcopy(String srcBucketName, List<String> srcObjectNames, String dstBucketName, List<String> dstObjectNames)SeeGoogleCloudStorage.copy(String, List, String, List)for details about expected behavior.voidcopy(Map<StorageResourceId,StorageResourceId> sourceToDestinationObjectsMap)SeeGoogleCloudStorage.copy(String, List, String, List)for details about expected behavior.WritableByteChannelcreate(StorageResourceId resourceId, CreateObjectOptions options)Creates and opens an object for writing.voidcreateBucket(String bucketName, CreateBucketOptions options)SeeGoogleCloudStorage.createBucket(String, CreateBucketOptions)for details about expected behavior.voidcreateEmptyObject(StorageResourceId resourceId)SeeGoogleCloudStorage.createEmptyObject(StorageResourceId)for details about expected behavior.voidcreateEmptyObject(StorageResourceId resourceId, CreateObjectOptions options)Creates an empty object, useful for placeholders representing, for example, directories.voidcreateEmptyObjects(List<StorageResourceId> resourceIds)SeeGoogleCloudStorage.createEmptyObjects(List)for details about expected behavior.voidcreateEmptyObjects(List<StorageResourceId> resourceIds, CreateObjectOptions options)Creates a list of empty objects; seeGoogleCloudStorage.createEmptyObject(StorageResourceId)for the single-item version of this method.voidcreateFolder(StorageResourceId resourceId, boolean recursive)SeeGoogleCloudStorage.createFolder(StorageResourceId,boolean)for details about expected behavior.static GoogleCloudStorageItemInfocreateItemInfoForBucket(StorageResourceId resourceId, com.google.api.services.storage.model.Bucket bucket)Helper for converting a StorageResourceId + Bucket into a GoogleCloudStorageItemInfo.static GoogleCloudStorageItemInfocreateItemInfoForStorageObject(com.google.api.services.storage.model.StorageObject object)static GoogleCloudStorageItemInfocreateItemInfoForStorageObject(StorageResourceId resourceId, com.google.api.services.storage.model.StorageObject object)Helper for converting a StorageResourceId + StorageObject into a GoogleCloudStorageItemInfo.voiddeleteBuckets(List<String> bucketNames)SeeGoogleCloudStorage.deleteBuckets(List)for details about expected behavior.voiddeleteFolders(List<FolderInfo> folders)SeeGoogleCloudStorage.deleteFolders(List)for details about expected behavior.voiddeleteObjects(List<StorageResourceId> fullObjectNames)SeeGoogleCloudStorage.deleteObjects(List)for details about expected behavior.GoogleCloudStorageItemInfogetFolderInfo(StorageResourceId resourceId)SeeGoogleCloudStorage.getFolderInfo(StorageResourceId)for details about expected behavior.GoogleCloudStorageItemInfogetItemInfo(StorageResourceId resourceId)SeeGoogleCloudStorage.getItemInfo(StorageResourceId)for details about expected behavior.List<GoogleCloudStorageItemInfo>getItemInfos(List<StorageResourceId> resourceIds)SeeGoogleCloudStorage.getItemInfos(List)for details about expected behavior.GoogleCloudStorageOptionsgetOptions()Retrieve the options that were used to create this GoogleCloudStorage.Map<String,Long>getStatistics()Retrieves the statistics associated with theGoogleCloudStorageinstance.booleanisHnBucket(URI src)Checks ifresourceIdbelongs to a Hierarchical namespace enabled bucket.List<GoogleCloudStorageItemInfo>listBucketInfo()SeeGoogleCloudStorage.listBucketInfo()for details about expected behavior.List<String>listBucketNames()SeeGoogleCloudStorage.listBucketNames()for details about expected behavior.GoogleCloudStorage.ListPage<FolderInfo>listFolderInfoForPrefixPage(String bucketName, String objectNamePrefix, ListFolderOptions listFolderOptions, String pageToken)Returns the list of folder resources.List<GoogleCloudStorageItemInfo>listObjectInfo(String bucketName, String objectNamePrefix, ListObjectOptions listOptions)ListsGoogleCloudStorageItemInfoof objects contained in the given bucket and whose names begin with the given prefix.GoogleCloudStorage.ListPage<GoogleCloudStorageItemInfo>listObjectInfoPage(String bucketName, String objectNamePrefix, ListObjectOptions listOptions, String pageToken)The same semantics asGoogleCloudStorage.listObjectInfo(java.lang.String, java.lang.String), but returns only result of single list request (1 page).List<GoogleCloudStorageItemInfo>listObjectInfoStartingFrom(String bucketName, String startOffset, ListObjectOptions listOptions)ListsGoogleCloudStorageItemInfoof objects contained in the given bucket and their name is lexicographically greater than or equal the provided offset.voidmove(Map<StorageResourceId,StorageResourceId> sourceToDestinationObjectsMap)SeeGoogleCloudStorage#move(Mapfor details about expected behavior.) SeekableByteChannelopen(GoogleCloudStorageItemInfo itemInfo, GoogleCloudStorageReadOptions readOptions)SeeGoogleCloudStorage.open(GoogleCloudStorageItemInfo)for details about expected behavior.SeekableByteChannelopen(StorageResourceId resourceId, GoogleCloudStorageReadOptions readOptions)SeeGoogleCloudStorage.open(StorageResourceId)for details about expected behavior.voidrenameHnFolder(URI src, URI dst)Renamessrctodstusing the rename LRO API.List<GoogleCloudStorageItemInfo>updateItems(List<UpdatableItemInfo> itemInfoList)Attempt to update metadata of the objects referenced within the passed itemInfo objects.static voidvalidateCopyArguments(String srcBucketName, List<String> srcObjectNames, String dstBucketName, List<String> dstObjectNames, GoogleCloudStorage googleCloudStorage)static voidvalidateCopyArguments(Map<StorageResourceId,StorageResourceId> sourceToDestinationObjectsMap, GoogleCloudStorage gcsImpl)Validates basic argument constraints like non-null, non-empty Strings, usingPreconditionsin addition to checking for src/dst bucket existence and compatibility of bucket properties such as location and storage-class.static voidvalidateMoveArguments(Map<StorageResourceId,StorageResourceId> sourceToDestinationObjectsMap)Validates basic argument constraints like non-null, non-empty Strings, usingPreconditionsin addition to checking for src/dst bucket equality.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.google.cloud.hadoop.gcsio.GoogleCloudStorage
create, createBucket, listObjectInfo, listObjectInfoPage, listObjectInfoStartingFrom, open, open
-
-
-
-
Method Detail
-
validateCopyArguments
public static void validateCopyArguments(String srcBucketName, List<String> srcObjectNames, String dstBucketName, List<String> dstObjectNames, GoogleCloudStorage googleCloudStorage) throws IOException
- Throws:
IOException
-
getOptions
public GoogleCloudStorageOptions getOptions()
Description copied from interface:GoogleCloudStorageRetrieve the options that were used to create this GoogleCloudStorage.- Specified by:
getOptionsin interfaceGoogleCloudStorage
-
create
public WritableByteChannel create(StorageResourceId resourceId, CreateObjectOptions options) throws IOException
Description copied from interface:GoogleCloudStorageCreates and opens an object for writing. The bucket must already exist. IfresourceIdcontains a known generationId or a generationId of 0, it is used instead of any "overwrite" settings in the providedCreateObjectOptions(overwrite will only succeed if the provided generationId matches the existing object, where a generationId of 0 indicates no existing object expected).- Specified by:
createin interfaceGoogleCloudStorage- Parameters:
resourceId- identifies a StorageObjectoptions- Options to use when creating the object- Returns:
- a channel for writing to the given object
- Throws:
IOException- on IO error
-
createBucket
public void createBucket(String bucketName, CreateBucketOptions options) throws IOException
SeeGoogleCloudStorage.createBucket(String, CreateBucketOptions)for details about expected behavior.- Specified by:
createBucketin interfaceGoogleCloudStorage- Parameters:
bucketName- name of the bucket to createoptions- options to use when creating bucket- Throws:
IOException- on IO error
-
createEmptyObject
public void createEmptyObject(StorageResourceId resourceId, CreateObjectOptions options) throws IOException
Description copied from interface:GoogleCloudStorageCreates an empty object, useful for placeholders representing, for example, directories. The bucket must already exist. If the object already exists, it is overwritten. SeeGoogleCloudStorage.create(StorageResourceId)for the behavior if StorageResourceId.getGenerationId() is explicitly set.- Specified by:
createEmptyObjectin interfaceGoogleCloudStorage- Parameters:
resourceId- identifies a StorageObjectoptions- options to use when creating the object- Throws:
IOException- on IO error
-
createEmptyObject
public void createEmptyObject(StorageResourceId resourceId) throws IOException
SeeGoogleCloudStorage.createEmptyObject(StorageResourceId)for details about expected behavior.- Specified by:
createEmptyObjectin interfaceGoogleCloudStorage- Parameters:
resourceId- identifies a StorageObject- Throws:
IOException- on IO error
-
createEmptyObjects
public void createEmptyObjects(List<StorageResourceId> resourceIds, CreateObjectOptions options) throws IOException
Description copied from interface:GoogleCloudStorageCreates a list of empty objects; seeGoogleCloudStorage.createEmptyObject(StorageResourceId)for the single-item version of this method. Implementations may use different flow than the single-item version for greater efficiency. SeeGoogleCloudStorage.create(StorageResourceId)for the behavior if StorageResourceId.getGenerationId() is explicitly set.- Specified by:
createEmptyObjectsin interfaceGoogleCloudStorage- Throws:
IOException
-
createEmptyObjects
public void createEmptyObjects(List<StorageResourceId> resourceIds) throws IOException
SeeGoogleCloudStorage.createEmptyObjects(List)for details about expected behavior.- Specified by:
createEmptyObjectsin interfaceGoogleCloudStorage- Throws:
IOException
-
open
public SeekableByteChannel open(StorageResourceId resourceId, GoogleCloudStorageReadOptions readOptions) throws IOException
SeeGoogleCloudStorage.open(StorageResourceId)for details about expected behavior.- Specified by:
openin interfaceGoogleCloudStorage- Parameters:
resourceId- identifies a StorageObjectreadOptions- Fine-grained options for behaviors of retries, buffering, etc.- Returns:
- a channel for reading from the given object
- Throws:
FileNotFoundException- if the given object does not existIOException- if object exists but cannot be opened
-
open
public SeekableByteChannel open(GoogleCloudStorageItemInfo itemInfo, GoogleCloudStorageReadOptions readOptions) throws IOException
SeeGoogleCloudStorage.open(GoogleCloudStorageItemInfo)for details about expected behavior.- Specified by:
openin interfaceGoogleCloudStorage- Parameters:
itemInfo- identifies a StorageObjectreadOptions- Fine-grained options for behaviors of retries, buffering, etc.- Returns:
- a channel for reading from the given object
- Throws:
FileNotFoundException- if the given object does not existIOException- if object exists but cannot be opened
-
deleteBuckets
public void deleteBuckets(List<String> bucketNames) throws IOException
SeeGoogleCloudStorage.deleteBuckets(List)for details about expected behavior.- Specified by:
deleteBucketsin interfaceGoogleCloudStorage- Parameters:
bucketNames- name of the buckets to delete- Throws:
FileNotFoundException- if the given bucket does not existIOException- on IO error
-
deleteObjects
public void deleteObjects(List<StorageResourceId> fullObjectNames) throws IOException
SeeGoogleCloudStorage.deleteObjects(List)for details about expected behavior.- Specified by:
deleteObjectsin interfaceGoogleCloudStorage- Parameters:
fullObjectNames- names of objects to delete with their respective bucketNames.- Throws:
FileNotFoundException- if the given object does not existIOException- if object exists but cannot be deleted
-
deleteFolders
public void deleteFolders(List<FolderInfo> folders) throws IOException
SeeGoogleCloudStorage.deleteFolders(List)for details about expected behavior.- Specified by:
deleteFoldersin interfaceGoogleCloudStorage- Parameters:
folders- names of folder resources to delete- Throws:
IOException- if folder exists but cannot be deleted
-
validateCopyArguments
public static void validateCopyArguments(Map<StorageResourceId,StorageResourceId> sourceToDestinationObjectsMap, GoogleCloudStorage gcsImpl) throws IOException
Validates basic argument constraints like non-null, non-empty Strings, usingPreconditionsin addition to checking for src/dst bucket existence and compatibility of bucket properties such as location and storage-class.- Parameters:
gcsImpl- A GoogleCloudStorage for retrieving bucket info via getItemInfo, but only if srcBucketName != dstBucketName; passed as a parameter so that this static method can be used by other implementations of GoogleCloudStorage that want to preserve the validation behavior of GoogleCloudStorageImpl, including disallowing cross-location copies.- Throws:
IOException
-
validateMoveArguments
public static void validateMoveArguments(Map<StorageResourceId,StorageResourceId> sourceToDestinationObjectsMap) throws IOException
Validates basic argument constraints like non-null, non-empty Strings, usingPreconditionsin addition to checking for src/dst bucket equality.- Throws:
IOException
-
copy
public void copy(String srcBucketName, List<String> srcObjectNames, String dstBucketName, List<String> dstObjectNames) throws IOException
SeeGoogleCloudStorage.copy(String, List, String, List)for details about expected behavior.- Specified by:
copyin interfaceGoogleCloudStorage- Parameters:
srcBucketName- name of the bucket containing the objects to copysrcObjectNames- names of the objects to copydstBucketName- name of the bucket to copy todstObjectNames- names of the objects after copy- Throws:
FileNotFoundException- if the source object or the destination bucket does not existIOException- in all other error cases
-
copy
public void copy(Map<StorageResourceId,StorageResourceId> sourceToDestinationObjectsMap) throws IOException
SeeGoogleCloudStorage.copy(String, List, String, List)for details about expected behavior.- Specified by:
copyin interfaceGoogleCloudStorage- Parameters:
sourceToDestinationObjectsMap- map of destination objects to be copied, keyed by source- Throws:
FileNotFoundException- if the source object or the destination bucket does not existIOException- in all other error cases
-
move
public void move(Map<StorageResourceId,StorageResourceId> sourceToDestinationObjectsMap) throws IOException
SeeGoogleCloudStorage#move(Mapfor details about expected behavior.) - Specified by:
movein interfaceGoogleCloudStorage- Parameters:
sourceToDestinationObjectsMap- map of destination objects to be moved, keyed by source- Throws:
FileNotFoundException- if the source object or the destination bucket does not existIOException- in all other error cases
-
listBucketNames
public List<String> listBucketNames() throws IOException
SeeGoogleCloudStorage.listBucketNames()for details about expected behavior.- Specified by:
listBucketNamesin interfaceGoogleCloudStorage- Throws:
IOException
-
listBucketInfo
public List<GoogleCloudStorageItemInfo> listBucketInfo() throws IOException
SeeGoogleCloudStorage.listBucketInfo()for details about expected behavior.- Specified by:
listBucketInfoin interfaceGoogleCloudStorage- Throws:
IOException
-
listObjectInfo
public List<GoogleCloudStorageItemInfo> listObjectInfo(String bucketName, String objectNamePrefix, ListObjectOptions listOptions) throws IOException
Description copied from interface:GoogleCloudStorageListsGoogleCloudStorageItemInfoof objects contained in the given bucket and whose names begin with the given prefix.Note: Although GCS does not implement a file system, it treats objects that contain a delimiter (
ListObjectOptions.getDelimiter()) as different from other objects when listing objects. This will be clearer with an example.Consider a bucket with objects:
o1,d1/,d1/o1,d1/o2-
With
prefix == nullanddelimiter == /, we get:d1/,o1Withprefix == nullanddelimiter == null, we get:o1,d1/,d1/o1,d1/o2Thus when delimiter is
null, the entire key name is considered an opaque string, otherwise only the part up to the first delimiter is considered.- Specified by:
listObjectInfoin interfaceGoogleCloudStorage- Parameters:
bucketName- bucket nameobjectNamePrefix- object name prefix or null if all objects in the bucket are desiredlistOptions- options to use when listing objects- Returns:
- list of objects
- Throws:
IOException- on IO error- See Also:
GoogleCloudStorage.listObjectInfo(String, String, ListObjectOptions)
-
listObjectInfoStartingFrom
public List<GoogleCloudStorageItemInfo> listObjectInfoStartingFrom(String bucketName, String startOffset, ListObjectOptions listOptions) throws IOException
Description copied from interface:GoogleCloudStorageListsGoogleCloudStorageItemInfoof objects contained in the given bucket and their name is lexicographically greater than or equal the provided offset.Note: As GCS doesn't implement a file system, directory is also treated as an object (if it's been created). This APi filters out all those directory object and maintain the order of items. This APi strictly expects delimiter in listOptions to be not set.
Consider a bucket with objects:
o1,d1/,d1/o1,d1/o2-
With
startOffset == "o1", we get:o1WithstartOffset == "d1/", we get:d1/o1d1/o2WithstartOffset == "d1/"o1, we get:d1/o1d1/o2This is an experimental API and can change without notice.
- Specified by:
listObjectInfoStartingFromin interfaceGoogleCloudStorage- Parameters:
bucketName- bucket namestartOffset- offset sting, all object with name greater and equal will be listed.listOptions- options to use when listing objects- Returns:
- list of objects
- Throws:
IOException- on IO error
-
listObjectInfoPage
public GoogleCloudStorage.ListPage<GoogleCloudStorageItemInfo> listObjectInfoPage(String bucketName, String objectNamePrefix, ListObjectOptions listOptions, String pageToken) throws IOException
Description copied from interface:GoogleCloudStorageThe same semantics asGoogleCloudStorage.listObjectInfo(java.lang.String, java.lang.String), but returns only result of single list request (1 page).- Specified by:
listObjectInfoPagein interfaceGoogleCloudStorage- Parameters:
bucketName- bucket nameobjectNamePrefix- object name prefix or null if all objects in the bucket are desiredlistOptions- options to use when listing objectspageToken- the page token- Returns:
GoogleCloudStorage.ListPageobject with listedGoogleCloudStorageItemInfos and next page token if any- Throws:
IOException- on IO error- See Also:
GoogleCloudStorage.listObjectInfoPage(String, String, ListObjectOptions, String)
-
listFolderInfoForPrefixPage
public GoogleCloudStorage.ListPage<FolderInfo> listFolderInfoForPrefixPage(String bucketName, String objectNamePrefix, ListFolderOptions listFolderOptions, String pageToken) throws IOException
Description copied from interface:GoogleCloudStorageReturns the list of folder resources. Applicable only for HN enabled bucket- Specified by:
listFolderInfoForPrefixPagein interfaceGoogleCloudStorage- Parameters:
bucketName- bucket nameobjectNamePrefix- folder resource name prefixlistFolderOptions- options to use when listing folder resourcespageToken- the page token- Returns:
GoogleCloudStorage.ListPagefolder resources with listedFolders- Throws:
IOException- on IO error- See Also:
GoogleCloudStorage.listFolderInfoForPrefixPage(String, String, ListFolderOptions, String)
-
createItemInfoForBucket
public static GoogleCloudStorageItemInfo createItemInfoForBucket(StorageResourceId resourceId, com.google.api.services.storage.model.Bucket bucket)
Helper for converting a StorageResourceId + Bucket into a GoogleCloudStorageItemInfo.
-
createItemInfoForStorageObject
public static GoogleCloudStorageItemInfo createItemInfoForStorageObject(com.google.api.services.storage.model.StorageObject object)
-
createItemInfoForStorageObject
public static GoogleCloudStorageItemInfo createItemInfoForStorageObject(StorageResourceId resourceId, com.google.api.services.storage.model.StorageObject object)
Helper for converting a StorageResourceId + StorageObject into a GoogleCloudStorageItemInfo.
-
getItemInfos
public List<GoogleCloudStorageItemInfo> getItemInfos(List<StorageResourceId> resourceIds) throws IOException
SeeGoogleCloudStorage.getItemInfos(List)for details about expected behavior.- Specified by:
getItemInfosin interfaceGoogleCloudStorage- Parameters:
resourceIds- names of the GCS StorageObjects or Buckets for which to retrieve info.- Returns:
- information about the given resourceIds.
- Throws:
IOException- on IO error
-
updateItems
public List<GoogleCloudStorageItemInfo> updateItems(List<UpdatableItemInfo> itemInfoList) throws IOException
Description copied from interface:GoogleCloudStorageAttempt to update metadata of the objects referenced within the passed itemInfo objects.- Specified by:
updateItemsin interfaceGoogleCloudStorage- Returns:
- Updated GoogleCloudStorageItemInfo objects for the referenced objects.
- Throws:
IOException- on IO error
-
getItemInfo
public GoogleCloudStorageItemInfo getItemInfo(StorageResourceId resourceId) throws IOException
SeeGoogleCloudStorage.getItemInfo(StorageResourceId)for details about expected behavior.- Specified by:
getItemInfoin interfaceGoogleCloudStorage- Parameters:
resourceId- identifies either root, a Bucket, or a StorageObject- Returns:
- information about the given item
- Throws:
IOException- on IO error
-
close
public void close()
SeeGoogleCloudStorage.close()for details about expected behavior.- Specified by:
closein interfaceGoogleCloudStorage
-
isHnBucket
public boolean isHnBucket(URI src) throws IOException
Description copied from interface:GoogleCloudStorageChecks ifresourceIdbelongs to a Hierarchical namespace enabled bucket. This takes a path and not the bucket name since the caller may not have permission to query the bucket.- Specified by:
isHnBucketin interfaceGoogleCloudStorage- Parameters:
src- Path for which the check need to be performed- Returns:
- Throws:
IOException
-
getFolderInfo
public GoogleCloudStorageItemInfo getFolderInfo(StorageResourceId resourceId) throws IOException
SeeGoogleCloudStorage.getFolderInfo(StorageResourceId)for details about expected behavior.- Specified by:
getFolderInfoin interfaceGoogleCloudStorage- Parameters:
resourceId- The StorageResourceId of the folder.- Throws:
IOException- on IO error.
-
createFolder
public void createFolder(StorageResourceId resourceId, boolean recursive) throws IOException
SeeGoogleCloudStorage.createFolder(StorageResourceId,boolean)for details about expected behavior.- Specified by:
createFolderin interfaceGoogleCloudStorage- Parameters:
resourceId- The StorageResourceId of the folder to create.recursive- If true, creates all nonexistent parent folders in the path.- Throws:
IOException- if the folder cannot be created, or if it already exists and is not a folder.
-
renameHnFolder
public void renameHnFolder(URI src, URI dst) throws IOException
Description copied from interface:GoogleCloudStorageRenamessrctodstusing the rename LRO API. This should be called only on an Hierarchical namespace enabled bucket.- Specified by:
renameHnFolderin interfaceGoogleCloudStorage- Parameters:
src- source pathdst- destination path- Throws:
IOException
-
compose
public void compose(String bucketName, List<String> sources, String destination, String contentType) throws IOException
Description copied from interface:GoogleCloudStorageComposes inputs into a single GCS object. This performs a GCS Compose. Objects will be composed according to the order they appear in the input. The destination object, if already present, will be overwritten. Sources and destination are assumed to be in the same bucket.- Specified by:
composein interfaceGoogleCloudStorage- Parameters:
bucketName- name of the bucket containing the sources and the destinationsources- names of the objects to be composeddestination- name of the resulting objectcontentType- content-type of composed object- Throws:
IOException- if the Compose operation was unsuccessful
-
composeObjects
public GoogleCloudStorageItemInfo composeObjects(List<StorageResourceId> sources, StorageResourceId destination, CreateObjectOptions options) throws IOException
Description copied from interface:GoogleCloudStorageComposes inputs into a single GCS object. This performs a GCS Compose. Objects will be composed according to the order they appear in the input. The destination object will have metadata set according tooptions. Overwrite semantics for the destination object will follow the same semantics asGoogleCloudStorage.create(StorageResourceId, CreateObjectOptions). SeeGoogleCloudStorage.create(StorageResourceId)for the behavior if StorageResourceId.getGenerationId() is explicitly set. The bucket must be the same for all sources and the destination.- Specified by:
composeObjectsin interfaceGoogleCloudStorage- Throws:
IOException
-
getStatistics
public Map<String,Long> getStatistics()
Description copied from interface:GoogleCloudStorageRetrieves the statistics associated with theGoogleCloudStorageinstance.- Specified by:
getStatisticsin interfaceGoogleCloudStorage
-
builder
public static GoogleCloudStorageImpl.Builder builder()
-
-