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 intBUFFER_SIZE -
Constructor Summary
Constructors Constructor Description Uploader(Cloudinary cloudinary, AbstractUploaderStrategy strategy) -
Method Summary
Modifier and Type Method Description java.util.MapaddContext(java.lang.String context, java.lang.String[] publicIds, java.util.Map options)Add a context keys and values.java.util.MapaddContext(java.util.Map context, java.lang.String[] publicIds, java.util.Map options)Add a context keys and values.java.util.MapaddTag(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.MapaddTag(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.MapcallApi(java.lang.String action, java.util.Map<java.lang.String,java.lang.Object> params, java.util.Map options, java.lang.Object file)java.util.MapcallApi(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.MapcallContextApi(java.lang.String context, java.lang.String command, java.lang.String[] publicIds, java.util.Map options)protected java.util.MapcallContextApi(java.util.Map context, java.lang.String command, java.lang.String[] publicIds, java.util.Map options)java.util.MapcallTagsApi(java.lang.String[] tag, java.lang.String command, java.lang.String[] publicIds, java.util.Map options)Cloudinarycloudinary()java.util.MapcreateArchive(ArchiveParams params)java.util.MapcreateArchive(java.util.Map options, java.lang.String targetFormat)java.util.MapcreateZip(java.util.Map options)java.util.MapdeleteByToken(java.lang.String token)java.util.Mapdestroy(java.lang.String publicId, java.util.Map options)java.util.Mapexplicit(java.lang.String publicId, java.util.Map options)java.util.Mapexplode(java.lang.String public_id, java.util.Map options)java.util.Mapgenerate_sprite(java.lang.String tag, java.util.Map options)Deprecated.java.util.MapgenerateSprite(java.lang.String[] urls, java.util.Map options)java.util.MapgenerateSprite(java.lang.String tag, java.util.Map options)java.lang.StringgetUploadUrl(java.util.Map options)java.lang.StringimageUploadTag(java.lang.String field, java.util.Map options, java.util.Map<java.lang.String,java.lang.Object> htmlOptions)java.util.Mapmulti(java.lang.String[] urls, java.util.Map options)java.util.Mapmulti(java.lang.String tag, java.util.Map options)java.util.MapremoveAllContext(java.lang.String[] publicIds, java.util.Map options)Remove all custom context from the specified public IDs.java.util.MapremoveAllTags(java.lang.String[] publicIds, java.util.Map options)Remove an array of tags to one or more assets in your cloud.java.util.MapremoveTag(java.lang.String[] tag, java.lang.String[] publicIds, java.util.Map options)Remove tags to one or more assets in your cloud.java.util.MapremoveTag(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.Maprename(java.lang.String fromPublicId, java.lang.String toPublicId, java.util.Map options)java.util.MapreplaceTag(java.lang.String[] tag, java.lang.String[] publicIds, java.util.Map options)Replaces tags to one or more assets in your cloud.java.util.MapreplaceTag(java.lang.String tag, java.lang.String[] publicIds, java.util.Map options)Replaces a tag to one or more assets in your cloud.voidsignRequestParams(java.util.Map<java.lang.String,java.lang.Object> params, java.util.Map options)java.util.Maptext(java.lang.String text, java.util.Map options)java.lang.StringunsignedImageUploadTag(java.lang.String field, java.lang.String uploadPreset, java.util.Map options, java.util.Map<java.lang.String,java.lang.Object> htmlOptions)java.util.MapunsignedUpload(java.lang.Object file, java.lang.String uploadPreset, java.util.Map options)java.util.MapunsignedUpload(java.lang.Object file, java.lang.String uploadPreset, java.util.Map options, ProgressCallback progressCallback)java.util.MapupdateMetadata(java.util.Map metadata, java.lang.String[] publicIds, java.util.Map options)Populates metadata fields with the given values.java.util.Mapupload(java.lang.Object file, java.util.Map options)java.util.Mapupload(java.lang.Object file, java.util.Map options, ProgressCallback progressCallback)java.util.MapuploadLarge(java.lang.Object file, java.util.Map options)java.util.MapuploadLarge(java.lang.Object file, java.util.Map options, int bufferSize)java.util.MapuploadLarge(java.lang.Object file, java.util.Map options, int bufferSize, long offset, java.lang.String uniqueUploadId, ProgressCallback progressCallback)java.util.MapuploadLarge(java.lang.Object file, java.util.Map options, int bufferSize, ProgressCallback progressCallback)java.util.MapuploadLarge(java.lang.Object file, java.util.Map options, ProgressCallback progressCallback)java.util.MapuploadLargeRaw(java.lang.Object file, java.util.Map options)java.util.MapuploadLargeRaw(java.lang.Object file, java.util.Map options, int bufferSize)java.util.MapuploadLargeRaw(java.lang.Object file, java.util.Map options, int bufferSize, ProgressCallback callback)java.util.MapuploadLargeRaw(java.lang.Object file, java.util.Map options, ProgressCallback progressCallback)java.lang.StringuploadTagParams(java.util.Map options)
-
Field Details
-
BUFFER_SIZE
public static final int BUFFER_SIZE- See Also:
- Constant Field Values
-
-
Constructor Details
-
Method Details
-
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
-
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.IOExceptionDeprecated.- 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.IOExceptionAdd 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.IOExceptionAdd 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.IOExceptionRemove 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.IOExceptionRemove 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.IOExceptionRemove 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.IOExceptionReplaces 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.IOExceptionReplaces 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.IOExceptionAdd 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.IOExceptionAdd 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.IOExceptionRemove 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
- 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.IOExceptionPopulates 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
-