package ch.werner_randelshofer.activation;/*Copyright (C) 1999-99 Werner Randelshoferwerner.randelshofer@mythen.chhttp://www.mythen.ch/w.randelshofer/    Permission to use this release of MultiCTD is herebygranted without fee provided that the complete copyrightnotice and this permission notice appear in all copiesand in supporting documentation.*/import java.io.*;import java.net.*;import ch.werner_randelshofer.iff.*;import java.util.Vector;import java.util.Enumeration;/**This content type detector serves as acontainer for a collection of content type detectors.@author	Werner Randelshofer, Staldenmattweg 2, CH-6405 Immensee, Switzerland.@version	1998-06-12	Created.*/public class MultiCTDimplements ContentTypeDetector	{	private Vector detectors_ = new Vector();	private int minimalLength_;		public void add(ContentTypeDetector detector)		{		minimalLength_ = Math.max(minimalLength_,detector.getMinimalDeterminableDataLength());		detectors_.addElement(detector);		}	/**	Return the number of bytes needed to	determine the content type.	*/ 	public int getMinimalDeterminableDataLength()		{		return minimalLength_;		}	/**	Return the base MIME Type of this data. This method is	expected to ALWAYS return a valid (non-null) MIME Type.	We suggest that if the DataTypeDetector implementation cannot 	determine the type of the data, it use the convention of	returning "application/octet-stream".	@param	the first few bytes of the data file.	@return MIME Type	*/	public String getContentType(byte[] dataSnippet)		{		Enumeration e = detectors_.elements();		String contentType = ContentTypeDetector.CONTENT_TYPE_UNKNOWN;		while (e.hasMoreElements() && contentType.equals(ContentTypeDetector.CONTENT_TYPE_UNKNOWN))			{			contentType = 				((ContentTypeDetector)e.nextElement()).getContentType(dataSnippet);			}		return contentType;		}	}