com.limegroup.gnutella
Class MediaType

java.lang.Object
  extended bycom.limegroup.gnutella.MediaType
All Implemented Interfaces:
java.io.Serializable

public class MediaType
extends java.lang.Object
implements java.io.Serializable

A generic type of media, i.e., "video" or "audio". Many different file formats can be of the same media type. MediaType's are immutable. Serializable for downloads.dat file; be careful when modifying!

See Also:
Serialized Form

Constructor Summary
MediaType(java.lang.String schema, java.lang.String description, java.lang.String[] extensions)
           
 
Method Summary
static MediaType getAudioMediaType()
           
static MediaType[] getDefaultMediaTypes()
           
 java.lang.String getDescription()
          Returns this' description key in localizable resources (now distinct from the result of the toString method)
static MediaType getImageMediaType()
           
static MediaType getVideoMediaType()
           
static boolean isDefaultType(java.lang.String schema)
           
 boolean matches(java.lang.String filename)
          Returns true if a file with the given name is of this media type, i.e., the suffix of the filename matches one of this' extensions.
 java.lang.String toString()
          Returns this' media-type (a MIME content-type category) (previously returned a description key)
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MediaType

public MediaType(java.lang.String schema,
                 java.lang.String description,
                 java.lang.String[] extensions)
Parameters:
schema - a MIME compliant non-localizable identifier, that matches file categories (and XSD schema names).
extensions - a list of all file extensions of this type. Must be all lowercase. If null, this matches any file.
Method Detail

matches

public boolean matches(java.lang.String filename)
Returns true if a file with the given name is of this media type, i.e., the suffix of the filename matches one of this' extensions.


toString

public java.lang.String toString()
Returns this' media-type (a MIME content-type category) (previously returned a description key)


getDescription

public java.lang.String getDescription()
Returns this' description key in localizable resources (now distinct from the result of the toString method)


getDefaultMediaTypes

public static final MediaType[] getDefaultMediaTypes()

isDefaultType

public static boolean isDefaultType(java.lang.String schema)

getAudioMediaType

public static MediaType getAudioMediaType()

getVideoMediaType

public static MediaType getVideoMediaType()

getImageMediaType

public static MediaType getImageMediaType()