/*
 * @(#)Recognizer.java  1.1  2002-02-12
 *
 * Copyright (c) 1999 Werner Randelshofer, Immensee, Switzerland.
 * All rights reserved.
 *
 * You may not use, copy or modify this file, except in compliance with the
 * license agreement you entered into with Werner Randelshofer.
 * For details see accompanying license terms.
 */
package ch.randelshofer.activation;

/**
 * A recognizer is able to guess the
 * data type of a data stream by inspecting a
 * few bytes at the beginning of the stream.
 *
 * @author  Werner Randelshofer, Hausmatt 10, CH-6405 Immensee, Switzerland.
 * @version 1.1 2002-02-12 Return 'application/octet-stream' when file type
 * can not be determined.
 * <br>1.0  1999-10-19
 *
 */
public interface Recognizer {
    /**
     * This value is returned by #getContentType(byte[])
     * when the recognizer was not able to determine the
     * content type of the data snippet.
     */
    public final static String CONTENT_TYPE_UNKNOWN = "content/unknown";
    /**
     * This value is returned by #getContentType(byte[])
     * when the recognizer was not able to determine the
     * content type of the data snippet.
     */
    public final static String CONTENT_TYPE_OCTET_STREAM = "application/octet-stream";
    
    
    /**
     * Return the number of bytes needed to
     * determine the content type.
     */
    public int getMinimalDeterminableDataLength();
    
    /**
     * Return the base MIME Type of this data. This method is
     * expected to ALWAYS return a valid (non-null) MIME Type.
     *
     * @param  dataSnippet the first few bytes of the data file.
     * @return MIME Type or "application/octet-stream" when file type
     * can not be determined.
     */
    public String getContentType(byte[] dataSnippet);
}

