Class Payload<T>

java.lang.Object
com.cloudinary.android.payload.Payload<T>
Direct Known Subclasses:
ByteArrayPayload, FilePayload, LocalUriPayload, ResourcePayload

public abstract class Payload<T>
extends java.lang.Object
Representation of a resource to upload
  • Field Summary

    Fields 
    Modifier and Type Field Description
    protected T data  
  • Constructor Summary

    Constructors 
    Constructor Description
    Payload()  
    Payload​(T data)  
  • Method Summary

    Modifier and Type Method Description
    boolean equals​(java.lang.Object o)  
    T getData()  
    abstract long getLength​(android.content.Context context)
    Get the length of the resource in bytes
    int hashCode()  
    abstract java.lang.Object prepare​(android.content.Context context)
    Prepares the payload to upload to Cloudinary
    abstract java.lang.String toUri()
    Constructs a uri of the data to upload, for serialization.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • data

      protected T data
  • Constructor Details

  • Method Details

    • toUri

      public abstract java.lang.String toUri()
      Constructs a uri of the data to upload, for serialization.
      Returns:
      The string representation of the uri.
    • getLength

      public abstract long getLength​(android.content.Context context) throws PayloadNotFoundException
      Get the length of the resource in bytes
      Parameters:
      context - Android context.
      Returns:
      The length
      Throws:
      PayloadNotFoundException - in case the resource doesn't exist.
    • prepare

      public abstract java.lang.Object prepare​(android.content.Context context) throws PayloadNotFoundException
      Prepares the payload to upload to Cloudinary
      Parameters:
      context - Android context
      Returns:
      An object formatted for Cloudinary uploader. This can be one of InputStream, Byte array, File object or an absolute path (as string).
      Throws:
      PayloadNotFoundException - If the request file or resource does not exist.
    • equals

      public boolean equals​(java.lang.Object o)
      Overrides:
      equals in class java.lang.Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class java.lang.Object
    • getData

      public T getData()