com.objectplanet.survey.plugin.interfaces
Interface IFileTypeDetector


public interface IFileTypeDetector

Interface for file type detection

Author:
Irina Brun

Method Summary
 java.lang.String getContentType(java.io.InputStream fileIn)
          Get content type for the input stream.
 boolean isCSS(java.lang.String contentType)
          Returns true if file with the passed content type is a css file
 boolean isHtml(java.lang.String contentType)
          Returns true if file with the passed content type is a html file
 boolean isImage(java.lang.String contentType)
          Returns true if file with the passed content type is a image file
 boolean isZip(java.lang.String contentType)
          Returns true if file with the passed content type is a zip file
 

Method Detail

getContentType

java.lang.String getContentType(java.io.InputStream fileIn)
                                throws java.io.IOException
Get content type for the input stream. Return Mime content type if possible to determine. Return null if unable to determine the content type.

If this method returns null the file type is considered unsupported. In that case:

Parameters:
fileIn - file to upload
Returns:
mime content type for the input stream or null
Throws:
java.io.IOException

isCSS

boolean isCSS(java.lang.String contentType)
Returns true if file with the passed content type is a css file

Parameters:
contentType - Content type returned by getContentType(fileIn)

isImage

boolean isImage(java.lang.String contentType)
Returns true if file with the passed content type is a image file

Parameters:
contentType - Content type returned by getContentType(fileIn)

isHtml

boolean isHtml(java.lang.String contentType)
Returns true if file with the passed content type is a html file

Parameters:
contentType - Content type returned by getContentType(fileIn)

isZip

boolean isZip(java.lang.String contentType)
Returns true if file with the passed content type is a zip file

Parameters:
contentType - Content type returned by getContentType(fileIn)

Copyright ? ObjectPlanet Inc. All Rights Reserved.

Built on December 20 2016