Package com.cloudinary
Class Uploader
- java.lang.Object
-
- com.cloudinary.Uploader
-
public class Uploader extends java.lang.Object
-
-
Field Summary
Fields Modifier and Type Field Description static int
BUFFER_SIZE
-
Constructor Summary
Constructors Constructor Description Uploader(Cloudinary cloudinary, AbstractUploaderStrategy strategy)
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description java.util.Map
addContext(java.lang.String context, java.lang.String[] publicIds, java.util.Map options)
Add a context keys and values.java.util.Map
addContext(java.util.Map context, java.lang.String[] publicIds, java.util.Map options)
Add a context keys and values.java.util.Map
addTag(java.lang.String[] tag, java.lang.String[] publicIds, java.util.Map options)
Add a tag to one or more assets in your cloud.java.util.Map
addTag(java.lang.String tag, java.lang.String[] publicIds, java.util.Map options)
Add a tag to one or more assets in your cloud.java.util.Map<java.lang.String,java.lang.Object>
buildUploadParams(java.util.Map options)
java.util.Map
callApi(java.lang.String action, java.util.Map<java.lang.String,java.lang.Object> params, java.util.Map options, java.lang.Object file)
java.util.Map
callApi(java.lang.String action, java.util.Map<java.lang.String,java.lang.Object> params, java.util.Map options, java.lang.Object file, ProgressCallback progressCallback)
protected java.util.Map
callContextApi(java.lang.String context, java.lang.String command, java.lang.String[] publicIds, java.util.Map options)
protected java.util.Map
callContextApi(java.util.Map context, java.lang.String command, java.lang.String[] publicIds, java.util.Map options)
java.util.Map
callTagsApi(java.lang.String[] tag, java.lang.String command, java.lang.String[] publicIds, java.util.Map options)
Cloudinary
cloudinary()
java.util.Map
createArchive(ArchiveParams params)
java.util.Map
createArchive(java.util.Map options, java.lang.String targetFormat)
java.util.Map
createZip(java.util.Map options)
java.util.Map
deleteByToken(java.lang.String token)
java.util.Map
destroy(java.lang.String publicId, java.util.Map options)
java.util.Map
explicit(java.lang.String publicId, java.util.Map options)
java.util.Map
explode(java.lang.String public_id, java.util.Map options)
java.util.Map
generate_sprite(java.lang.String tag, java.util.Map options)
Deprecated.java.util.Map
generateSprite(java.lang.String[] urls, java.util.Map options)
java.util.Map
generateSprite(java.lang.String tag, java.util.Map options)
java.lang.String
getUploadUrl(java.util.Map options)
java.lang.String
imageUploadTag(java.lang.String field, java.util.Map options, java.util.Map<java.lang.String,java.lang.Object> htmlOptions)
java.util.Map
multi(java.lang.String[] urls, java.util.Map options)
java.util.Map
multi(java.lang.String tag, java.util.Map options)
java.util.Map
removeAllContext(java.lang.String[] publicIds, java.util.Map options)
Remove all custom context from the specified public IDs.java.util.Map
removeAllTags(java.lang.String[] publicIds, java.util.Map options)
Remove an array of tags to one or more assets in your cloud.java.util.Map
removeTag(java.lang.String[] tag, java.lang.String[] publicIds, java.util.Map options)
Remove tags to one or more assets in your cloud.java.util.Map
removeTag(java.lang.String tag, java.lang.String[] publicIds, java.util.Map options)
Remove a tag to one or more assets in your cloud.java.util.Map
rename(java.lang.String fromPublicId, java.lang.String toPublicId, java.util.Map options)
java.util.Map
replaceTag(java.lang.String[] tag, java.lang.String[] publicIds, java.util.Map options)
Replaces tags to one or more assets in your cloud.java.util.Map
replaceTag(java.lang.String tag, java.lang.String[] publicIds, java.util.Map options)
Replaces a tag to one or more assets in your cloud.void
signRequestParams(java.util.Map<java.lang.String,java.lang.Object> params, java.util.Map options)
java.util.Map
text(java.lang.String text, java.util.Map options)
java.lang.String
unsignedImageUploadTag(java.lang.String field, java.lang.String uploadPreset, java.util.Map options, java.util.Map<java.lang.String,java.lang.Object> htmlOptions)
java.util.Map
unsignedUpload(java.lang.Object file, java.lang.String uploadPreset, java.util.Map options)
java.util.Map
unsignedUpload(java.lang.Object file, java.lang.String uploadPreset, java.util.Map options, ProgressCallback progressCallback)
java.util.Map
updateMetadata(java.util.Map metadata, java.lang.String[] publicIds, java.util.Map options)
Populates metadata fields with the given values.java.util.Map
upload(java.lang.Object file, java.util.Map options)
java.util.Map
upload(java.lang.Object file, java.util.Map options, ProgressCallback progressCallback)
java.util.Map
uploadLarge(java.lang.Object file, java.util.Map options)
java.util.Map
uploadLarge(java.lang.Object file, java.util.Map options, int bufferSize)
java.util.Map
uploadLarge(java.lang.Object file, java.util.Map options, int bufferSize, long offset, java.lang.String uniqueUploadId, ProgressCallback progressCallback)
java.util.Map
uploadLarge(java.lang.Object file, java.util.Map options, int bufferSize, ProgressCallback progressCallback)
java.util.Map
uploadLarge(java.lang.Object file, java.util.Map options, ProgressCallback progressCallback)
java.util.Map
uploadLargeRaw(java.lang.Object file, java.util.Map options)
java.util.Map
uploadLargeRaw(java.lang.Object file, java.util.Map options, int bufferSize)
java.util.Map
uploadLargeRaw(java.lang.Object file, java.util.Map options, int bufferSize, ProgressCallback callback)
java.util.Map
uploadLargeRaw(java.lang.Object file, java.util.Map options, ProgressCallback progressCallback)
java.lang.String
uploadTagParams(java.util.Map options)
-
-
-
Field Detail
-
BUFFER_SIZE
public static final int BUFFER_SIZE
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
Uploader
public Uploader(Cloudinary cloudinary, AbstractUploaderStrategy strategy)
-
-
Method Detail
-
callApi
public java.util.Map callApi(java.lang.String action, java.util.Map<java.lang.String,java.lang.Object> params, java.util.Map options, java.lang.Object file) throws java.io.IOException
- Throws:
java.io.IOException
-
callApi
public java.util.Map callApi(java.lang.String action, java.util.Map<java.lang.String,java.lang.Object> params, java.util.Map options, java.lang.Object file, ProgressCallback progressCallback) throws java.io.IOException
- Throws:
java.io.IOException
-
cloudinary
public Cloudinary cloudinary()
-
buildUploadParams
public java.util.Map<java.lang.String,java.lang.Object> buildUploadParams(java.util.Map options)
-
unsignedUpload
public java.util.Map unsignedUpload(java.lang.Object file, java.lang.String uploadPreset, java.util.Map options) throws java.io.IOException
- Throws:
java.io.IOException
-
unsignedUpload
public java.util.Map unsignedUpload(java.lang.Object file, java.lang.String uploadPreset, java.util.Map options, ProgressCallback progressCallback) throws java.io.IOException
- Throws:
java.io.IOException
-
upload
public java.util.Map upload(java.lang.Object file, java.util.Map options) throws java.io.IOException
- Throws:
java.io.IOException
-
upload
public java.util.Map upload(java.lang.Object file, java.util.Map options, ProgressCallback progressCallback) throws java.io.IOException
- Throws:
java.io.IOException
-
uploadLargeRaw
public java.util.Map uploadLargeRaw(java.lang.Object file, java.util.Map options) throws java.io.IOException
- Throws:
java.io.IOException
-
uploadLargeRaw
public java.util.Map uploadLargeRaw(java.lang.Object file, java.util.Map options, ProgressCallback progressCallback) throws java.io.IOException
- Throws:
java.io.IOException
-
uploadLargeRaw
public java.util.Map uploadLargeRaw(java.lang.Object file, java.util.Map options, int bufferSize) throws java.io.IOException
- Throws:
java.io.IOException
-
uploadLargeRaw
public java.util.Map uploadLargeRaw(java.lang.Object file, java.util.Map options, int bufferSize, ProgressCallback callback) throws java.io.IOException
- Throws:
java.io.IOException
-
uploadLarge
public java.util.Map uploadLarge(java.lang.Object file, java.util.Map options) throws java.io.IOException
- Throws:
java.io.IOException
-
uploadLarge
public java.util.Map uploadLarge(java.lang.Object file, java.util.Map options, ProgressCallback progressCallback) throws java.io.IOException
- Throws:
java.io.IOException
-
uploadLarge
public java.util.Map uploadLarge(java.lang.Object file, java.util.Map options, int bufferSize) throws java.io.IOException
- Throws:
java.io.IOException
-
uploadLarge
public java.util.Map uploadLarge(java.lang.Object file, java.util.Map options, int bufferSize, ProgressCallback progressCallback) throws java.io.IOException
- Throws:
java.io.IOException
-
uploadLarge
public java.util.Map uploadLarge(java.lang.Object file, java.util.Map options, int bufferSize, long offset, java.lang.String uniqueUploadId, ProgressCallback progressCallback) throws java.io.IOException
- Throws:
java.io.IOException
-
destroy
public java.util.Map destroy(java.lang.String publicId, java.util.Map options) throws java.io.IOException
- Throws:
java.io.IOException
-
rename
public java.util.Map rename(java.lang.String fromPublicId, java.lang.String toPublicId, java.util.Map options) throws java.io.IOException
- Throws:
java.io.IOException
-
explicit
public java.util.Map explicit(java.lang.String publicId, java.util.Map options) throws java.io.IOException
- Throws:
java.io.IOException
-
generate_sprite
@Deprecated public java.util.Map generate_sprite(java.lang.String tag, java.util.Map options) throws java.io.IOException
Deprecated.- Throws:
java.io.IOException
-
generateSprite
public java.util.Map generateSprite(java.lang.String tag, java.util.Map options) throws java.io.IOException
- Throws:
java.io.IOException
-
generateSprite
public java.util.Map generateSprite(java.lang.String[] urls, java.util.Map options) throws java.io.IOException
- Throws:
java.io.IOException
-
multi
public java.util.Map multi(java.lang.String[] urls, java.util.Map options) throws java.io.IOException
- Throws:
java.io.IOException
-
multi
public java.util.Map multi(java.lang.String tag, java.util.Map options) throws java.io.IOException
- Throws:
java.io.IOException
-
explode
public java.util.Map explode(java.lang.String public_id, java.util.Map options) throws java.io.IOException
- Throws:
java.io.IOException
-
addTag
public java.util.Map addTag(java.lang.String tag, java.lang.String[] publicIds, java.util.Map options) throws java.io.IOException
Add a tag to one or more assets in your cloud. Tags are used to categorize and organize your images, and can also be used to apply group actions to images, for example to delete images, create sprites, ZIP files, JSON lists, or animated GIFs. Each image can be assigned one or more tags, which is a short name that you can dynamically use (no need to predefine tags).- Parameters:
tag
- - The tag to assign.publicIds
- - An array of Public IDs of images uploaded to Cloudinary.options
- - An object holding the available parameters for the request. options may include 'exclusive' (boolean) which causes clearing this tag from all other resources- Returns:
- A map with the public ids returned from the server
- Throws:
java.io.IOException
-
addTag
public java.util.Map addTag(java.lang.String[] tag, java.lang.String[] publicIds, java.util.Map options) throws java.io.IOException
Add a tag to one or more assets in your cloud. Tags are used to categorize and organize your images, and can also be used to apply group actions to images, for example to delete images, create sprites, ZIP files, JSON lists, or animated GIFs. Each image can be assigned one or more tags, which is a short name that you can dynamically use (no need to predefine tags).- Parameters:
tag
- - An array of tags to assign.publicIds
- - An array of Public IDs of images uploaded to Cloudinary.options
- - An object holding the available parameters for the request. options may include 'exclusive' (boolean) which causes clearing this tag from all other resources- Returns:
- A map with the public ids returned from the server.
- Throws:
java.io.IOException
-
removeTag
public java.util.Map removeTag(java.lang.String tag, java.lang.String[] publicIds, java.util.Map options) throws java.io.IOException
Remove a tag to one or more assets in your cloud. Tags are used to categorize and organize your images, and can also be used to apply group actions to images, for example to delete images, create sprites, ZIP files, JSON lists, or animated GIFs. Each image can be assigned one or more tags, which is a short name that you can dynamically use (no need to predefine tags).- Parameters:
tag
- - The tag to remove.publicIds
- - An array of Public IDs of images uploaded to Cloudinary.options
- - An object holding the available parameters for the request. options may include 'exclusive' (boolean) which causes clearing this tag from all other resources- Returns:
- - A map with the public ids returned from the server.
- Throws:
java.io.IOException
-
removeTag
public java.util.Map removeTag(java.lang.String[] tag, java.lang.String[] publicIds, java.util.Map options) throws java.io.IOException
Remove tags to one or more assets in your cloud. Tags are used to categorize and organize your images, and can also be used to apply group actions to images, for example to delete images, create sprites, ZIP files, JSON lists, or animated GIFs. Each image can be assigned one or more tags, which is a short name that you can dynamically use (no need to predefine tags).- Parameters:
tag
- - The array of tags to remove.publicIds
- - An array of Public IDs of images uploaded to Cloudinary.options
- - An object holding the available parameters for the request. options may include 'exclusive' (boolean) which causes clearing this tag from all other resources- Returns:
- - * @return - A map with the public ids returned from the server.
- Throws:
java.io.IOException
-
removeAllTags
public java.util.Map removeAllTags(java.lang.String[] publicIds, java.util.Map options) throws java.io.IOException
Remove an array of tags to one or more assets in your cloud. Tags are used to categorize and organize your images, and can also be used to apply group actions to images, for example to delete images, create sprites, ZIP files, JSON lists, or animated GIFs. Each image can be assigned one or more tags, which is a short name that you can dynamically use (no need to predefine tags).- Parameters:
publicIds
- - An array of Public IDs of images uploaded to Cloudinary.options
- - An object holding the available parameters for the request. options may include 'exclusive' (boolean) which causes clearing this tag from all other resources- Returns:
- - * @return - A map with the public ids returned from the server.
- Throws:
java.io.IOException
-
replaceTag
public java.util.Map replaceTag(java.lang.String tag, java.lang.String[] publicIds, java.util.Map options) throws java.io.IOException
Replaces a tag to one or more assets in your cloud. Tags are used to categorize and organize your images, and can also be used to apply group actions to images, for example to delete images, create sprites, ZIP files, JSON lists, or animated GIFs. Each image can be assigned one or more tags, which is a short name that you can dynamically use (no need to predefine tags).- Parameters:
tag
- - The tag to replace.publicIds
- - An array of Public IDs of images uploaded to Cloudinary.options
- - An object holding the available options for the request. options may include 'exclusive' (boolean) which causes clearing this tag from all other resources- Returns:
- - A map with the public ids returned from the server.
- Throws:
java.io.IOException
-
replaceTag
public java.util.Map replaceTag(java.lang.String[] tag, java.lang.String[] publicIds, java.util.Map options) throws java.io.IOException
Replaces tags to one or more assets in your cloud. Tags are used to categorize and organize your images, and can also be used to apply group actions to images, for example to delete images, create sprites, ZIP files, JSON lists, or animated GIFs. Each image can be assigned one or more tags, which is a short name that you can dynamically use (no need to predefine tags).- Parameters:
tag
- - An array of tag to replace.publicIds
- - An array of Public IDs of images uploaded to Cloudinary.options
- - An object holding the available options for the request. options may include 'exclusive' (boolean) which causes clearing this tag from all other resources- Returns:
- - A map with the public ids returned from the server.
- Throws:
java.io.IOException
-
callTagsApi
public java.util.Map callTagsApi(java.lang.String[] tag, java.lang.String command, java.lang.String[] publicIds, java.util.Map options) throws java.io.IOException
- Throws:
java.io.IOException
-
addContext
public java.util.Map addContext(java.util.Map context, java.lang.String[] publicIds, java.util.Map options) throws java.io.IOException
Add a context keys and values. If a particular key already exists, the value associated with the key is updated.- Parameters:
context
- a map of key and value. Serialized to "key1=value1|key2=value2"publicIds
- the public IDs of the resources to updateoptions
- additional options passed to the request- Returns:
- a list of public IDs that were updated
- Throws:
java.io.IOException
-
addContext
public java.util.Map addContext(java.lang.String context, java.lang.String[] publicIds, java.util.Map options) throws java.io.IOException
Add a context keys and values. If a particular key already exists, the value associated with the key is updated.- Parameters:
context
- Serialized context in the form of "key1=value1|key2=value2"publicIds
- the public IDs of the resources to updateoptions
- additional options passed to the request- Returns:
- a list of public IDs that were updated
- Throws:
java.io.IOException
-
removeAllContext
public java.util.Map removeAllContext(java.lang.String[] publicIds, java.util.Map options) throws java.io.IOException
Remove all custom context from the specified public IDs.- Parameters:
publicIds
- the public IDs of the resources to updateoptions
- additional options passed to the request- Returns:
- a list of public IDs that were updated
- Throws:
java.io.IOException
-
callContextApi
protected java.util.Map callContextApi(java.util.Map context, java.lang.String command, java.lang.String[] publicIds, java.util.Map options) throws java.io.IOException
- Throws:
java.io.IOException
-
callContextApi
protected java.util.Map callContextApi(java.lang.String context, java.lang.String command, java.lang.String[] publicIds, java.util.Map options) throws java.io.IOException
- Throws:
java.io.IOException
-
text
public java.util.Map text(java.lang.String text, java.util.Map options) throws java.io.IOException
- Throws:
java.io.IOException
-
createArchive
public java.util.Map createArchive(java.util.Map options, java.lang.String targetFormat) throws java.io.IOException
- Throws:
java.io.IOException
-
createZip
public java.util.Map createZip(java.util.Map options) throws java.io.IOException
- Throws:
java.io.IOException
-
createArchive
public java.util.Map createArchive(ArchiveParams params) throws java.io.IOException
- Throws:
java.io.IOException
-
signRequestParams
public void signRequestParams(java.util.Map<java.lang.String,java.lang.Object> params, java.util.Map options)
-
uploadTagParams
public java.lang.String uploadTagParams(java.util.Map options)
-
getUploadUrl
public java.lang.String getUploadUrl(java.util.Map options)
-
unsignedImageUploadTag
public java.lang.String unsignedImageUploadTag(java.lang.String field, java.lang.String uploadPreset, java.util.Map options, java.util.Map<java.lang.String,java.lang.Object> htmlOptions)
-
imageUploadTag
public java.lang.String imageUploadTag(java.lang.String field, java.util.Map options, java.util.Map<java.lang.String,java.lang.Object> htmlOptions)
-
deleteByToken
public java.util.Map deleteByToken(java.lang.String token) throws java.lang.Exception
- Throws:
java.lang.Exception
-
updateMetadata
public java.util.Map updateMetadata(java.util.Map metadata, java.lang.String[] publicIds, java.util.Map options) throws java.io.IOException
Populates metadata fields with the given values. Existing values will be overwritten.- Parameters:
metadata
- a map of field name and value.publicIds
- the public IDs of the resources to updateoptions
- additional options passed to the request- Returns:
- a list of public IDs that were updated
- Throws:
java.io.IOException
-
-