com.flexive.shared.media
Class FxMimeTypeWrapper

java.lang.Object
  extended by com.flexive.shared.media.FxMimeTypeWrapper
All Implemented Interfaces:
java.io.Serializable

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

A class to handle / wrap mime types incl. various tool methods

Since:
3.1
Author:
Christopher Blasnik (c.blasnik@flexive.com), UCS - unique computing solutions gmbh (http://www.ucs.at)
See Also:
Serialized Form

Constructor Summary
FxMimeTypeWrapper()
          Def.
FxMimeTypeWrapper(FxMimeType mimeType)
          Construct using a single MimeType
FxMimeTypeWrapper(java.lang.String mimeTypes)
          Construct using a (list) of mime type(s)
 
Method Summary
 void addMimeType(FxMimeType mimeType)
          Add a mime type by providing an instance of the MimeType enum
 void addMimeTypes(java.lang.String mimeTypes)
          Add a mime type by providing a String parameter The parameter can either be a single mime type or a list of comma-separated values
 boolean contains(FxMimeType mimeType)
          Check if a given mimeType exists within the FxMimeType obj.
 boolean contains(FxMimeType mimeType, boolean mainTypeOnly)
          Check if the given mime type exists, optionally for the main type only
 boolean contains(java.lang.String mimeType)
          Check if a given mimeType exists within the FxMimeType obj.
 java.util.List<FxMimeType> getMimeTypes()
          Retrieve the List of all MimeTypes, returns an empty list if none were registered
 boolean removeMimeType(FxMimeType mimeType)
          Remove a mime type by providing an instance of the MimeType enum
 boolean removeMimeType(java.lang.String mimeType)
          Remove a mime type by providing a String parameter, e.g.
 void setMimeTypes(java.util.List<FxMimeType> mimeTypes)
          Set a the internal List of MimeTypes FxMimeType by providing a List of MimeType
 java.lang.String toString()
          Creates a comma separated list of mime types
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

FxMimeTypeWrapper

public FxMimeTypeWrapper()
Def. constructor


FxMimeTypeWrapper

public FxMimeTypeWrapper(java.lang.String mimeTypes)
Construct using a (list) of mime type(s)

Parameters:
mimeTypes - a single mime type or a comma-separated list of mime types

FxMimeTypeWrapper

public FxMimeTypeWrapper(FxMimeType mimeType)
Construct using a single MimeType

Parameters:
mimeType - a MimeType
Method Detail

getMimeTypes

public java.util.List<FxMimeType> getMimeTypes()
Retrieve the List of all MimeTypes, returns an empty list if none were registered

Returns:
the List<MimeType>>

setMimeTypes

public void setMimeTypes(java.util.List<FxMimeType> mimeTypes)
Set a the internal List of MimeTypes FxMimeType by providing a List of MimeType

Parameters:
mimeTypes - the List of MimeTypes

addMimeType

public void addMimeType(FxMimeType mimeType)
Add a mime type by providing an instance of the MimeType enum

Parameters:
mimeType - a MimeType

addMimeTypes

public void addMimeTypes(java.lang.String mimeTypes)
Add a mime type by providing a String parameter The parameter can either be a single mime type or a list of comma-separated values

Parameters:
mimeTypes - the mime type as a String, e.g. "audio/wav", or several values such as "audio/wav,audio/mp3"

removeMimeType

public boolean removeMimeType(FxMimeType mimeType)
Remove a mime type by providing an instance of the MimeType enum

Parameters:
mimeType - the MimeType t.b. removed
Returns:
true if the mimetype was removed

removeMimeType

public boolean removeMimeType(java.lang.String mimeType)
Remove a mime type by providing a String parameter, e.g. "image/png"

Parameters:
mimeType - the mime type as a String
Returns:
returns true if the removal was successful

contains

public boolean contains(FxMimeType mimeType)
Check if a given mimeType exists within the FxMimeType obj.

Parameters:
mimeType - a MimeType
Returns:
returns true if found

contains

public boolean contains(FxMimeType mimeType,
                        boolean mainTypeOnly)
Check if the given mime type exists, optionally for the main type only

Parameters:
mimeType - the FxMimeType
mainTypeOnly - set to true if only the main mime type should be checked
Returns:
true if the mime type exists

contains

public boolean contains(java.lang.String mimeType)
Check if a given mimeType exists within the FxMimeType obj.

Parameters:
mimeType - a MimeType
Returns:
returns true if found

toString

public java.lang.String toString()
Creates a comma separated list of mime types

Overrides:
toString in class java.lang.Object
Returns:
returns the list of mime types