ModeShape Distribution 3.0.0.Alpha6

org.modeshape.jcr.mimetype
Class ExtensionBasedMimeTypeDetector

java.lang.Object
  extended by org.modeshape.common.util.MimeTypeUtil
      extended by org.modeshape.jcr.mimetype.ExtensionBasedMimeTypeDetector
All Implemented Interfaces:
MimeTypeDetector

@Immutable
@ThreadSafe
public class ExtensionBasedMimeTypeDetector
extends MimeTypeUtil
implements MimeTypeDetector

A MimeTypeDetector that attempts to match the extension of the supplied name against a set of known file extensions.


Field Summary
static MimeTypeDetector INSTANCE
           
 
Fields inherited from class org.modeshape.common.util.MimeTypeUtil
MIME_TYPE_EXTENSIONS_RESOURCE_PATH
 
Constructor Summary
ExtensionBasedMimeTypeDetector()
           
 
Method Summary
 String mimeTypeOf(String name, InputStream content)
          Returns the MIME-type of a data source, using its supplied content and/or its supplied name, depending upon the implementation.
 
Methods inherited from class org.modeshape.common.util.MimeTypeUtil
getDefaultMappings, load, mimeTypeOf, mimeTypeOf
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

INSTANCE

public static final MimeTypeDetector INSTANCE
Constructor Detail

ExtensionBasedMimeTypeDetector

public ExtensionBasedMimeTypeDetector()
Method Detail

mimeTypeOf

public String mimeTypeOf(String name,
                         InputStream content)
Description copied from interface: MimeTypeDetector
Returns the MIME-type of a data source, using its supplied content and/or its supplied name, depending upon the implementation. If the MIME-type cannot be determined, either a "default" MIME-type or null may be returned, where the former will prevent earlier registered MIME-type detectors from being consulted.

Note that detector implementations should not close the supplied input stream and should try their best to reset the stream.

Specified by:
mimeTypeOf in interface MimeTypeDetector
Parameters:
name - The name of the data source; may be null.
content - The content of the data source; may be null.
Returns:
The MIME-type of the data source, or optionally null if the MIME-type could not be determined.

ModeShape Distribution 3.0.0.Alpha6

Copyright © 2008-2012 JBoss, a division of Red Hat. All Rights Reserved.