Enum MediaFormat

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Comparable<MediaFormat>

    public enum MediaFormat
    extends java.lang.Enum<MediaFormat>
    Static data about various media formats support by NewPipe, eg mime type, extension
    • Field Summary

      Fields 
      Modifier and Type Field Description
      int id  
      java.lang.String mimeType  
      java.lang.String name  
      java.lang.String suffix  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static java.util.List<MediaFormat> getAllFromMimeType​(java.lang.String mimeType)
      Get all media formats which have the given mime type.
      static MediaFormat getFormatById​(int id)
      Get the media format by its id.
      static MediaFormat getFromMimeType​(java.lang.String mimeType)
      Return the first MediaFormat with the supplied mime type.
      static MediaFormat getFromSuffix​(java.lang.String suffix)
      Get the first media format that has the given suffix/file extension.
      static java.lang.String getMimeById​(int id)
      Return the MIME type of the media format with the supplied id
      java.lang.String getMimeType()
      Get the mime type
      java.lang.String getName()
      Get the name of the format
      static java.lang.String getNameById​(int id)
      Return the friendly name of the media format with the supplied id
      java.lang.String getSuffix()
      Get the filename extension
      static java.lang.String getSuffixById​(int id)
      Return the file extension of the media format with the supplied id
      static MediaFormat valueOf​(java.lang.String name)
      Returns the enum constant of this type with the specified name.
      static MediaFormat[] values()
      Returns an array containing the constants of this enum type, in the order they are declared.
      • Methods inherited from class java.lang.Enum

        clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
      • Methods inherited from class java.lang.Object

        getClass, notify, notifyAll, wait, wait, wait
    • Field Detail

      • id

        public final int id
      • name

        @Nonnull
        public final java.lang.String name
      • suffix

        @Nonnull
        public final java.lang.String suffix
      • mimeType

        @Nonnull
        public final java.lang.String mimeType
    • Method Detail

      • values

        public static MediaFormat[] values()
        Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
        for (MediaFormat c : MediaFormat.values())
            System.out.println(c);
        
        Returns:
        an array containing the constants of this enum type, in the order they are declared
      • valueOf

        public static MediaFormat valueOf​(java.lang.String name)
        Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
        Parameters:
        name - the name of the enum constant to be returned.
        Returns:
        the enum constant with the specified name
        Throws:
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        java.lang.NullPointerException - if the argument is null
      • getNameById

        @Nonnull
        public static java.lang.String getNameById​(int id)
        Return the friendly name of the media format with the supplied id
        Parameters:
        id - the id of the media format. Currently an arbitrary, NewPipe-specific number.
        Returns:
        the friendly name of the MediaFormat associated with this ids, or an empty String if none match it.
      • getSuffixById

        @Nonnull
        public static java.lang.String getSuffixById​(int id)
        Return the file extension of the media format with the supplied id
        Parameters:
        id - the id of the media format. Currently an arbitrary, NewPipe-specific number.
        Returns:
        the file extension of the MediaFormat associated with this ids, or an empty String if none match it.
      • getMimeById

        @Nullable
        public static java.lang.String getMimeById​(int id)
        Return the MIME type of the media format with the supplied id
        Parameters:
        id - the id of the media format. Currently an arbitrary, NewPipe-specific number.
        Returns:
        the MIME type of the MediaFormat associated with this ids, or an empty String if none match it.
      • getFromMimeType

        @Nullable
        public static MediaFormat getFromMimeType​(java.lang.String mimeType)
        Return the first MediaFormat with the supplied mime type. There might be more formats which have the same mime type. To retrieve those, use getAllFromMimeType(String).
        Returns:
        MediaFormat associated with this mime type, or null if none match it.
      • getAllFromMimeType

        @Nonnull
        public static java.util.List<MediaFormat> getAllFromMimeType​(java.lang.String mimeType)
        Get all media formats which have the given mime type.
        Parameters:
        mimeType - the mime type to search for
        Returns:
        a modifiable List which contains the MediaFormats that have the given mime type.
      • getFormatById

        @Nullable
        public static MediaFormat getFormatById​(int id)
        Get the media format by its id.
        Parameters:
        id - the id
        Returns:
        the id of the media format or null.
      • getFromSuffix

        @Nullable
        public static MediaFormat getFromSuffix​(java.lang.String suffix)
        Get the first media format that has the given suffix/file extension.
        Returns:
        the matching MediaFormat or null if no associated format is found
      • getName

        @Nonnull
        public java.lang.String getName()
        Get the name of the format
        Returns:
        the name of the format
      • getSuffix

        @Nonnull
        public java.lang.String getSuffix()
        Get the filename extension
        Returns:
        the filename extension
      • getMimeType

        @Nonnull
        public java.lang.String getMimeType()
        Get the mime type
        Returns:
        the mime type