Class PreprocessChain<T>
java.lang.Object
com.cloudinary.android.preprocess.PreprocessChain<T>
- Type Parameters:
T- The type of the resource to execute the processing on (e.g.Bitmap)
public abstract class PreprocessChain<T>
extends java.lang.Object
A preprocess chain to run on resource before uploading. Pass an instance of a populated chain to
UploadRequest.preprocess(PreprocessChain).
The processing steps will run by the order in which they were added to the chain. Note: The best practice is to use a concrete subclass
rather than extend this class. A chain can be used for manipulating and/or validating resources before starting the upload.-
Constructor Summary
Constructors Constructor Description PreprocessChain() -
Method Summary
Modifier and Type Method Description PreprocessChain<T>addStep(Preprocess<T> step)Add a preprocessing step to the chainjava.lang.Stringexecute(android.content.Context context, Payload payload)Execute the processing chain.protected abstract ResourceDecoder<T>getDefaultDecoder()protected abstract ResourceEncoder<T>getDefaultEncoder()booleanisEmpty()Checks if this chain is an empty chain (NOP chain).PreprocessChain<T>loadWith(ResourceDecoder<T> decoder)Set a decoder to decode the resourcePreprocessChain<T>saveWith(ResourceEncoder<T> encoder)Set an encoder to encode the resource
-
Constructor Details
-
PreprocessChain
public PreprocessChain()
-
-
Method Details
-
getDefaultEncoder
-
getDefaultDecoder
-
loadWith
Set a decoder to decode the resource- Parameters:
decoder- The decoder to use- Returns:
- itself for chaining.
-
saveWith
Set an encoder to encode the resource- Parameters:
encoder- The encoder to use- Returns:
- itself for chaining.
-
addStep
Add a preprocessing step to the chain- Parameters:
step- Preprocess step- Returns:
- itself for chaining.
-
execute
public java.lang.String execute(android.content.Context context, Payload payload) throws PayloadNotFoundException, PreprocessExceptionExecute the processing chain. this is for INTERNAL use by the upload request itself. Do not call this directly.- Parameters:
context- Android contextpayload- Payload to run the chain on- Returns:
- A filepath of the end result of the chain
- Throws:
PayloadNotFoundException- if the payload is not foundPayloadDecodeException- if the payload is found but cannot be decodedResourceCreationException- if the processing is done but the result cannot be saved.PreprocessException
-
isEmpty
public boolean isEmpty()Checks if this chain is an empty chain (NOP chain).- Returns:
- True if it's empty.
-