OOP MimeParser Version 3.5

com.bentofw.util
Class ImageSizeChecker

java.lang.Object
  extended by com.bentofw.util.ImageSizeChecker

public class ImageSizeChecker
extends java.lang.Object

Check width/height of the image file. Requires JDK 1.4 or later.

Author:
Jun Inamori

Method Summary
 void checkImageSize(byte[] bin, java.lang.String mime, java.lang.String filename, int max_width, int max_height)
          Throws the exception if the width/height of the image file exceeds the maximum width/height.
static ImageSizeChecker getInstance()
          Reads ImageSizeChecker.properties and returns the instance of this class.
 void setDebug(boolean db)
           
 void setLogger(GenericLogger logger)
          Set GenericLogger object to which the log messages will be written.
 boolean shouldCheck(java.lang.String mime)
          Returns true if the specified mime-type is the subject of this class.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static ImageSizeChecker getInstance()
                                    throws NoPropertyFileException,
                                           NestedException
Reads ImageSizeChecker.properties and returns the instance of this class.

Only at the first invocation, this method reads the property file and initializes its instance. All the subsequent calls just return the same instance, and that's all.

Returns:
The instance of this class.
Throws:
NoPropertyFileException
NestedException

setDebug

public void setDebug(boolean db)

shouldCheck

public boolean shouldCheck(java.lang.String mime)
Returns true if the specified mime-type is the subject of this class. Otherwise, false.

Please call this method before you call

Parameters:
mime - mime-type
Returns:
true if the specified mime-type is the subject of this class. Otherwise, false.

checkImageSize

public void checkImageSize(byte[] bin,
                           java.lang.String mime,
                           java.lang.String filename,
                           int max_width,
                           int max_height)
                    throws LargeImageException,
                           SimpleException,
                           CorruptedBinaryContentsException
Throws the exception if the width/height of the image file exceeds the maximum width/height.

Please call: before you call this method.

Parameters:
bin - The binary contents of the image file to be checked.
mime - The mime-type of the image file to be checked.
filename - The file name of the image file to be checked.
max_width - The maximum width
max_height - The maximum height

Throws:
LargeImageException
SimpleException
CorruptedBinaryContentsException
See Also:



setLogger

public void setLogger(GenericLogger logger)
Set GenericLogger object to which the log messages will be written.

Parameters:
logger - GenericLogger object to which the log messages will be written.

OOP MimeParser Version 3.5

ALL CONTENTS COPYRIGHT 2005, OOP-Research Corporation. All rights reserved.
Any questions and comments are welcome to OOP-Research Corporation.