net.sourceforge.groboutils.uicapture.v1
Class DefaultScreenScraper

java.lang.Object
  |
  +--net.sourceforge.groboutils.uicapture.v1.DefaultScreenScraper
All Implemented Interfaces:
IScreenScraper

public class DefaultScreenScraper
extends java.lang.Object
implements IScreenScraper

Writes images to files using the javax.imageio package.

Version:
Jan 7, 2002
Author:
Matt Albrecht groboclown@users.sourceforge.net

Constructor Summary
DefaultScreenScraper()
          Find the first writer format name we come across.
DefaultScreenScraper(java.lang.String writerFormatName)
          Use the given writerFormatName to write images to disk.
 
Method Summary
protected  void assertFormatName()
          Discover if the current format name is supported.
 java.lang.String getFileExtention()
          Discover the file extention for images created by this scraper.
 void writeImageToFile(java.awt.image.BufferedImage image, java.io.File file)
          Write the given image to the given file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultScreenScraper

public DefaultScreenScraper()
Find the first writer format name we come across.

Throws:
java.lang.IllegalArgumentException - thrown if there are no formats supported.

DefaultScreenScraper

public DefaultScreenScraper(java.lang.String writerFormatName)
Use the given writerFormatName to write images to disk.

Throws:
java.lang.IllegalArgumentException - thrown if the given name is not supported.
Method Detail

writeImageToFile

public void writeImageToFile(java.awt.image.BufferedImage image,
                             java.io.File file)
                      throws java.io.IOException
Write the given image to the given file.

Specified by:
writeImageToFile in interface IScreenScraper
Parameters:
image - The screen image to write to disk.
file - The File to save the image as.
Throws:
java.io.IOException - thrown if there was a problem saving the image to the file.
java.lang.IllegalArgumentException - if any parameter is null.
java.lang.IllegalStateException - if no appropriate writer could be found.

getFileExtention

public java.lang.String getFileExtention()
Discover the file extention for images created by this scraper. This does not include a '.'.

Specified by:
getFileExtention in interface IScreenScraper
Returns:
the extention for files this scraper writes.

assertFormatName

protected void assertFormatName()
Discover if the current format name is supported.

Throws:
java.lang.IllegalArgumentException - thrown if the current name is not supported.


Copyright © 2001-2003 by The GroboUtils Project