|
Lizzy v1.1.1 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object javax.swing.filechooser.FileFilter christophedelory.content.type.ContentType
public class ContentType
Defines a mapping between a group of one or more file extensions, and a group of one or more MIME type. MIME stands for Multipurpose Internet Mail Extension, as defined in RFC 2045 and 2046.
Constructor Summary | |
---|---|
ContentType(String[] extensions,
String[] mimeTypes,
PlayerSupport[] playerSupports,
String description)
Builds a new content type from the input parameters. |
Method Summary | |
---|---|
boolean |
accept(File f)
Tests whether the name of the given file matches the specified file extension pattern. |
Object |
clone()
Creates and returns a "shallow" copy of this object. |
String |
getDescription()
Returns the friendly description of the content type. |
String[] |
getExtensions()
Returns the list of file extensions. |
String[] |
getMimeTypes()
Returns the list of MIME types. |
PlayerSupport[] |
getPlayerSupports()
Returns the list of players supporting this type of content. |
boolean |
matchExtension(String pattern)
Tests whether this content type matches the specified file extension pattern. |
void |
setDescription(String description)
Initializes the friendly description of the content type. |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ContentType(String[] extensions, String[] mimeTypes, PlayerSupport[] playerSupports, String description)
extensions
- an array of file extensions. Shall not be null
.mimeTypes
- an array of MIME types. Shall not be null
.playerSupports
- an array of player support information. May be null
.description
- a (friendly) description of the new content type. May be null
.
NullPointerException
- if extensions
or one of its component is null
.
NullPointerException
- if mimeTypes
or one of its component is null
.
IllegalArgumentException
- if extensions
has no items (empty array).
IllegalArgumentException
- if mimeTypes
has no items (empty array).String.toLowerCase(Locale)
Method Detail |
---|
public String[] getExtensions()
null
nor empty.public String[] getMimeTypes()
null
nor empty.public PlayerSupport[] getPlayerSupports()
null
.public String getDescription()
getDescription
in class FileFilter
null
.setDescription(java.lang.String)
,
FileFilter.getDescription()
public void setDescription(String description)
description
- a content type description. May be null
.getDescription()
public boolean matchExtension(String pattern)
pattern
- a file name, or more generally a pattern including a file extension. Shall not be null
.
true
if pattern
matches this content type.
NullPointerException
- if pattern
is null
.getExtensions()
,
String.toLowerCase(Locale)
,
String.endsWith(java.lang.String)
public boolean accept(File f)
JFileChooser
.
accept
in class FileFilter
f
- the file to test. Shall not be null
.
true
if the file extension matches this content type.
NullPointerException
- if f
is null
.matchExtension(java.lang.String)
public Object clone() throws CloneNotSupportedException
clone
in class Object
CloneNotSupportedException
- shall not be thrown, because this class is cloneable.Object.clone()
|
© 2008-2009 Christophe Delory | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |