degu.util.mimetypedetector
Class MimeTypeDetector

java.lang.Object
  extended by degu.util.mimetypedetector.MimeTypeDetector
Direct Known Subclasses:
MimeTypeDetectorJMagicMatch

public abstract class MimeTypeDetector
extends java.lang.Object

Base class for all magic bytes MimeTypeDetectors


Constructor Summary
MimeTypeDetector()
           
 
Method Summary
abstract  MimeTypeT detect(byte[] buffer)
           
 MimeTypeT detect(java.io.File file)
          detetermines file's mimetype, the first 8192 bytes of the file are examined
 MimeTypeT detect(java.io.File file, int bufferSize)
          determines file's mimetype
 MimeTypeT detect(java.io.InputStream is)
           
abstract  void initialize()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MimeTypeDetector

public MimeTypeDetector()
Method Detail

detect

public abstract MimeTypeT detect(byte[] buffer)
                          throws FailedToDetectMimeTypeException,
                                 NotSupportedMimeTypeException
Throws:
FailedToDetectMimeTypeException
NotSupportedMimeTypeException

initialize

public abstract void initialize()
                         throws MimeTypeDetectorInitializeException
Throws:
MimeTypeDetectorInitializeException

detect

public MimeTypeT detect(java.io.File file)
                 throws FailedToDetectMimeTypeException,
                        NotSupportedMimeTypeException
detetermines file's mimetype, the first 8192 bytes of the file are examined

Parameters:
file - File to check
Returns:
Throws:
FailedToDetectMimeTypeException
NotSupportedMimeTypeException

detect

public MimeTypeT detect(java.io.InputStream is)
                 throws FailedToDetectMimeTypeException,
                        NotSupportedMimeTypeException
Throws:
FailedToDetectMimeTypeException
NotSupportedMimeTypeException

detect

public MimeTypeT detect(java.io.File file,
                        int bufferSize)
                 throws FailedToDetectMimeTypeException,
                        NotSupportedMimeTypeException
determines file's mimetype

Parameters:
file - File to check
bufferSize - number of the first bytes in file, which will be checked
Returns:
Throws:
FailedToDetectMimeTypeException
NotSupportedMimeTypeException