Class Format

java.lang.Object
org.monte.media.av.Format

public class Format extends Object
Specifies the format of a media, for example of audio and video.
Author:
Werner Randelshofer
  • Constructor Details

    • Format

      public Format(Map<FormatKey<?>,Object> properties)
      Creates a new format onlyWith the specified properties.
    • Format

      public Format(Object... p)
      Creates a new format onlyWith the specified properties. The properties must be given as key value pairs.
  • Method Details

    • get

      public <T> T get(FormatKey<T> key)
    • get

      public <T> T get(FormatKey<T> key, T defaultValue)
    • containsKey

      public boolean containsKey(FormatKey<?> key)
    • getProperties

      public Map<FormatKey<?>,Object> getProperties()
      Gets the properties of the format as an unmodifiable map.
    • getKeys

      public Set<FormatKey<?>> getKeys()
      Gets the keys of the format as an unmodifiable set.
    • matches

      public boolean matches(Format that)
      Returns true if that format matches this format. That is iff all properties defined in both format objects are identical. Properties which are only defined in one of the format objects are not considered.
      Parameters:
      that - Another format.
      Returns:
      True if the other format matches this format.
    • matchesWithout

      public boolean matchesWithout(Format that, FormatKey<?>... without)
    • append

      public Format append(Format that)
      Creates a new format which contains all properties from this format and additional properties from that format.

      If a property is specified in both formats, then the property value from this format is used. It overwrites that format.

      If one of the format has more properties than the other, then the new format is more specific than this format.

      Parameters:
      that -
      Returns:
      That format with properties overwritten by this format.
    • append

      public Format append(Object... p)
      Creates a new format which contains all properties from this format and additional properties listed.

      If a property is specified in both formats, then the property value from this format is used. It overwrites that format.

      If one of the format has more properties than the other, then the new format is more specific than this format.

      Parameters:
      p - The properties must be given as key value pairs.
      Returns:
      That format with properties overwritten by this format.
    • prepend

      public Format prepend(Format that)
      Creates a new format which contains all properties from the specified format and additional properties from this format.

      If a property is specified in both formats, then the property value from that format is used. It overwrites this format.

      If one of the format has more properties than the other, then the new format is more specific than this format.

      Parameters:
      that -
      Returns:
      That format with properties overwritten by this format.
    • prepend

      public Format prepend(Object... p)
      Creates a new format which contains all specified properties and additional properties from this format.

      If a property is specified in both formats, then the property value from this format is used. It overwrites that format.

      If one of the format has more properties than the other, then the new format is more specific than this format.

      Parameters:
      p - The properties must be given as key value pairs.
      Returns:
      That format with properties overwritten by this format.
    • intersectKeys

      public Format intersectKeys(FormatKey<?>... keys)
      Creates a new format which only has the specified keys (or less).

      If the keys are reduced, then the new format is less specific than this format.

    • removeKeys

      public Format removeKeys(FormatKey<?>... keys)
      Creates a new format without the specified keys.

      If the keys are reduced, then the new format is less specific than this format.

    • containsKeys

      public Format containsKeys(FormatKey<?>... keys)
      Returns true if the format has the specified keys.
    • toString

      public String toString()
      Overrides:
      toString in class Object