ModeShape Distribution 3.0.0.Alpha6

org.modeshape.jcr.mimetype
Class MimeTypeDetectors

java.lang.Object
  extended by org.modeshape.jcr.mimetype.MimeTypeDetectors
All Implemented Interfaces:
MimeTypeDetector

@ThreadSafe
public final class MimeTypeDetectors
extends Object
implements MimeTypeDetector

Implementation of MimeTypeDetector which holds an inner list of different MimeTypeDetector implementations and queries each of them, in order to determine a mime-type.

Author:
Horia Chiorean

Constructor Summary
MimeTypeDetectors()
           
 
Method Summary
 String mimeTypeOf(String name, InputStream content)
          Returns the first non-null result of iterating over the registered MIME-type detectors If the MIME-type cannot be determined by any registered detector, "text/plain" or "application/octet-stream" will be returned, the former only if it is determined the stream contains no nulls.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MimeTypeDetectors

public MimeTypeDetectors()
Method Detail

mimeTypeOf

public String mimeTypeOf(String name,
                         InputStream content)
                  throws IOException
Returns the first non-null result of iterating over the registered MIME-type detectors If the MIME-type cannot be determined by any registered detector, "text/plain" or "application/octet-stream" will be returned, the former only if it is determined the stream contains no nulls.

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; never null.
Throws:
IOException - If an error occurs reading the supplied content.

ModeShape Distribution 3.0.0.Alpha6

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