eu.medsea.mimeutil.detector
Class OpendesktopMimeDetector

java.lang.Object
  extended by eu.medsea.mimeutil.detector.MimeDetector
      extended by eu.medsea.mimeutil.detector.OpendesktopMimeDetector

public class OpendesktopMimeDetector
extends MimeDetector


Constructor Summary
OpendesktopMimeDetector()
           
OpendesktopMimeDetector(String mimeCacheFile)
           
 
Method Summary
 String dump()
           
 String getDescription()
          Abstract method to be implement by concrete MimeDetector(s).
 Collection getMimeTypesByteArray(byte[] data)
          This method is unable to perform glob matching as no name is available.
 Collection getMimeTypesFile(File file)
          This method resolves mime types closely in accordance with the RECOMENDED order of detection detailed in the Opendesktop shared mime database specification http://standards.freedesktop.org/shared-mime-info-spec/shared-mime-info-spec-latest.html See the Recommended checking order.
 Collection getMimeTypesInputStream(InputStream in)
          This method is unable to perform glob matching as no name is available.
static void main(String[] args)
          CAUSION: This is a TEST ONLY method and will not run on anybody else's environment without serious modifications to paths and file names
 
Methods inherited from class eu.medsea.mimeutil.detector.MimeDetector
addMimeHandler, getMimeHandlers, getMimeTypes, getMimeTypes, getMimeTypes, getMimeTypes, getMimeTypes, getName, removeMimeHandler
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OpendesktopMimeDetector

public OpendesktopMimeDetector(String mimeCacheFile)

OpendesktopMimeDetector

public OpendesktopMimeDetector()
Method Detail

getDescription

public String getDescription()
Description copied from class: MimeDetector
Abstract method to be implement by concrete MimeDetector(s).

Specified by:
getDescription in class MimeDetector
Returns:
description of this MimeDetector

getMimeTypesFile

public Collection getMimeTypesFile(File file)
                            throws UnsupportedOperationException
This method resolves mime types closely in accordance with the RECOMENDED order of detection detailed in the Opendesktop shared mime database specification http://standards.freedesktop.org/shared-mime-info-spec/shared-mime-info-spec-latest.html See the Recommended checking order.

Specified by:
getMimeTypesFile in class MimeDetector
Returns:
collection of matched MimeType(s)
Throws:
UnsupportedOperationException

getMimeTypesInputStream

public Collection getMimeTypesInputStream(InputStream in)
                                   throws UnsupportedOperationException
This method is unable to perform glob matching as no name is available. This means that it does not follow the recommended order of detection defined in the shared mime database spec http://standards.freedesktop.org/shared-mime-info-spec/shared-mime-info-spec-latest.html

Specified by:
getMimeTypesInputStream in class MimeDetector
Parameters:
in - InputStream. If the InputStream does not support the mark() and reset() methods it will throw an exception.
Returns:
collection of matched MimeType(s)
Throws:
UnsupportedOperationException

getMimeTypesByteArray

public Collection getMimeTypesByteArray(byte[] data)
                                 throws UnsupportedOperationException
This method is unable to perform glob matching as no name is available. This means that it does not follow the recommended order of detection defined in the shared mime database spec http://standards.freedesktop.org/shared-mime-info-spec/shared-mime-info-spec-latest.html

Specified by:
getMimeTypesByteArray in class MimeDetector
Parameters:
data - byte []. Is a byte array that you want to parse for matching mime types.
Returns:
collection of matched MimeType(s)
Throws:
UnsupportedOperationException

dump

public String dump()

main

public static void main(String[] args)
                 throws Exception
CAUSION: This is a TEST ONLY method and will not run on anybody else's environment without serious modifications to paths and file names

Parameters:
args -
Throws:
Exception


Copyright © 2007-2009 Medsea Business Solutions S.L.. All Rights Reserved.