Copyright 2012-02-25 Werner Randelshofer

ch.randelshofer.activation
Class MultiRecognizer

java.lang.Object
  extended by ch.randelshofer.activation.MultiRecognizer
All Implemented Interfaces:
Recognizer

public class MultiRecognizer
extends java.lang.Object
implements Recognizer

This content type detector serves as a container for a collection of content type detectors.

Version:
1.1 2002-02-12 Handle content type unknown and octet streams as unknown data types.
1.0 1999-10-19
Author:
Werner Randelshofer, Hausmatt 10, CH-6405 Immensee, Switzerland.

Field Summary
 
Fields inherited from interface ch.randelshofer.activation.Recognizer
CONTENT_TYPE_OCTET_STREAM, CONTENT_TYPE_UNKNOWN
 
Constructor Summary
MultiRecognizer()
           
 
Method Summary
 void add(Recognizer detector)
           
 java.lang.String getContentType(byte[] dataSnippet)
          Return the base MIME Type of this data.
 int getMinimalDeterminableDataLength()
          Return the number of bytes needed to determine the content type.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MultiRecognizer

public MultiRecognizer()
Method Detail

add

public void add(Recognizer detector)

getMinimalDeterminableDataLength

public int getMinimalDeterminableDataLength()
Return the number of bytes needed to determine the content type.

Specified by:
getMinimalDeterminableDataLength in interface Recognizer

getContentType

public java.lang.String getContentType(byte[] dataSnippet)
Return the base MIME Type of this data. This method is expected to ALWAYS return a valid (non-null) MIME Type.

Specified by:
getContentType in interface Recognizer
Parameters:
dataSnippet - the first few bytes of the data file.
Returns:
MIME Type or 'application/octet-stream' if content type can not be determined.

Copyright 2012-02-25 Werner Randelshofer