Copyright 2012-02-25 Werner Randelshofer

ch.randelshofer.activation
Class RIFFRecognizer

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

public class RIFFRecognizer
extends java.lang.Object
implements Recognizer

This recognizer can identify RIFF files.

Version:
1.0 2005-01-09 Created.
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
 
Method Summary
 java.lang.String getContentType(byte[] dataSnippet)
          Return the base MIME Type of this data.
static RIFFRecognizer getInstance()
           
 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
 

Method Detail

getInstance

public static RIFFRecognizer getInstance()

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.

Returns "x-riff/*contenttype*" for RIFF FORM files, where as *contenttype* stands for the FORM type. e.g. returns "x-riff/AVI" for RIFF AVI files.

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