Class ResourcePayload

java.lang.Object
com.cloudinary.android.payload.Payload<java.lang.Integer>
com.cloudinary.android.payload.ResourcePayload

public class ResourcePayload
extends Payload<java.lang.Integer>
This class is used to handle uploading of images/videos represented as an Android raw resource id
  • Field Summary

    Fields inherited from class com.cloudinary.android.payload.Payload

    data
  • Constructor Summary

    Constructors 
    Constructor Description
    ResourcePayload​(java.lang.Integer rawResourceId)  
  • Method Summary

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

    Methods inherited from class com.cloudinary.android.payload.Payload

    equals, getData, hashCode

    Methods inherited from class java.lang.Object

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

    • ResourcePayload

      public ResourcePayload​(java.lang.Integer rawResourceId)
  • Method Details

    • toUri

      public java.lang.String toUri()
      Description copied from class: Payload
      Constructs a uri of the data to upload, for serialization.
      Specified by:
      toUri in class Payload<java.lang.Integer>
      Returns:
      The string representation of the uri.
    • getLength

      public long getLength​(android.content.Context context) throws PayloadNotFoundException
      Description copied from class: Payload
      Get the length of the resource in bytes
      Specified by:
      getLength in class Payload<java.lang.Integer>
      Parameters:
      context - Android context.
      Returns:
      The length
      Throws:
      PayloadNotFoundException - in case the resource doesn't exist.
    • prepare

      public java.lang.Object prepare​(android.content.Context context) throws PayloadNotFoundException
      Description copied from class: Payload
      Prepares the payload to upload to Cloudinary
      Specified by:
      prepare in class Payload<java.lang.Integer>
      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.