j2d.io.file
Class PPMToolkit

java.lang.Object
  extended by j2d.io.file.PPMToolkit

public class PPMToolkit
extends java.lang.Object

Wrapper for Jef Poskanzer's PPM classes to create a simple toolkit interface for reading and writing PPM files. (http://www.acme.com/java/) Note that the PPM format supports ASCII or binary representation of the pixel data. Both of these formats are supported for input. For output, only binary pixel data is supported.


Constructor Summary
PPMToolkit()
           
 
Method Summary
static java.awt.Image getImage(java.io.File infile, boolean zipped)
          Read a PPM file (binary or ASCII formats 1-6)
static void saveImage(java.awt.Image img, java.io.File outfile, boolean zipped)
          Write a PPM file (binary format 6)
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PPMToolkit

public PPMToolkit()
Method Detail

getImage

public static java.awt.Image getImage(java.io.File infile,
                                      boolean zipped)
                               throws java.io.FileNotFoundException,
                                      java.io.IOException
Read a PPM file (binary or ASCII formats 1-6)

Parameters:
infile - The PPM image file.
zipped - Flag to select ZIP decompression.
Returns:
An AWT Image object containing the read data.
Throws:
java.io.FileNotFoundException
java.io.IOException

saveImage

public static void saveImage(java.awt.Image img,
                             java.io.File outfile,
                             boolean zipped)
                      throws java.io.FileNotFoundException,
                             java.io.IOException
Write a PPM file (binary format 6)

Parameters:
img - The AWT Image to be written.
outfile - The file location to which to write.
zipped - Flag to select ZIP compression.
Throws:
java.io.FileNotFoundException
java.io.IOException