Package com.google.android.exoplayer2.upstream.cache

## Class ContentMetadataMutations

- java.lang.Object
- - com.google.android.exoplayer2.upstream.cache.ContentMetadataMutations

-     public class ContentMetadataMutations
      extends Object

  Defines multiple mutations on metadata value which are applied atomically. This class isn't thread safe.

- - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `ContentMetadataMutations()` | Constructs a DefaultMetadataMutations.

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `Map<String,​Object>` | `getEditedValues()` | Returns a map of metadata name, value pairs to be set.
    `List<String>` | `getRemovedValues()` | Returns a list of names of metadata values to be removed.
    `ContentMetadataMutations` | `remove​(String name)` | Adds a mutation to remove a metadata value.
    `ContentMetadataMutations` | `set​(String name, byte[] value)` | Adds a mutation to set a metadata value.
    `ContentMetadataMutations` | `set​(String name, long value)` | Adds a mutation to set a metadata value.
    `ContentMetadataMutations` | `set​(String name, String value)` | Adds a mutation to set a metadata value.
    `static ContentMetadataMutations` | `setContentLength​(ContentMetadataMutations mutations, long length)` | Adds a mutation to set the `ContentMetadata.KEY_CONTENT_LENGTH` value, or to remove any existing value if `C.LENGTH_UNSET` is passed.
    `static ContentMetadataMutations` | `setRedirectedUri​(ContentMetadataMutations mutations, Uri uri)` | Adds a mutation to set the `ContentMetadata.KEY_REDIRECTED_URI` value, or to remove any existing entry if `null` is passed.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### ContentMetadataMutations

          public ContentMetadataMutations()

      Constructs a DefaultMetadataMutations.

  - ### Method Detail

    - #### setContentLength

          public static ContentMetadataMutations setContentLength​(ContentMetadataMutations mutations,
                                                                  long length)

      Adds a mutation to set the `ContentMetadata.KEY_CONTENT_LENGTH` value, or to remove any existing value if `C.LENGTH_UNSET` is passed.
      Parameters:
        `mutations` - The mutations to modify.
        `length` - The length value, or `C.LENGTH_UNSET` to remove any existing entry.
      Returns:
        The mutations instance, for convenience.

    - #### setRedirectedUri

          public static ContentMetadataMutations setRedirectedUri​(ContentMetadataMutations mutations,
                                                                  @Nullable
                                                                  Uri uri)

      Adds a mutation to set the `ContentMetadata.KEY_REDIRECTED_URI` value, or to remove any existing entry if `null` is passed.
      Parameters:
        `mutations` - The mutations to modify.
        `uri` - The `Uri` value, or `null` to remove any existing entry.
      Returns:
        The mutations instance, for convenience.

    - #### set

          public ContentMetadataMutations set​(String name,
                                              String value)

      Adds a mutation to set a metadata value.
      Parameters:
        `name` - The name of the metadata value.
        `value` - The value to be set.
      Returns:
        This instance, for convenience.

    - #### set

          public ContentMetadataMutations set​(String name,
                                              long value)

      Adds a mutation to set a metadata value.
      Parameters:
        `name` - The name of the metadata value.
        `value` - The value to be set.
      Returns:
        This instance, for convenience.

    - #### set

          public ContentMetadataMutations set​(String name,
                                              byte[] value)

      Adds a mutation to set a metadata value.
      Parameters:
        `name` - The name of the metadata value.
        `value` - The value to be set.
      Returns:
        This instance, for convenience.

    - #### remove

          public ContentMetadataMutations remove​(String name)

      Adds a mutation to remove a metadata value.
      Parameters:
        `name` - The name of the metadata value.
      Returns:
        This instance, for convenience.

    - #### getRemovedValues

          public List<String> getRemovedValues()

      Returns a list of names of metadata values to be removed.

    - #### getEditedValues

          public Map<String,​Object> getEditedValues()

      Returns a map of metadata name, value pairs to be set. Values are copied.