j2d.face
Class JPGFile

java.lang.Object
  extended by j2d.face.JPGFile

public class JPGFile
extends java.lang.Object

JPG File reader/writer. Uses native com.sun libraries (which may deprecate affineTransform any time)

Version:
1.0
Author:
Konrad Rzeszutek

Constructor Summary
JPGFile(java.io.File filename)
          Read the PPM File.
 
Method Summary
 byte[] getBytes()
          Get the data as byte array.
 double[] getDouble()
          Get the data as double array.
 int getHeight()
          Get the height of the PPM image.
 int getWidth()
          Get the width of the PPM image.
static void writeImage(java.lang.String fn, byte[] data, int width, int height)
          Write to <code>fn</code> file the <code>data</code> using the <code>width, height</code> variables.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JPGFile

public JPGFile(java.io.File filename)
        throws java.io.FileNotFoundException,
               java.io.IOException
Read the PPM File.

Throws:
java.io.FileNotFoundException - if the directory/image specified is wrong
java.io.IOException - if there are problems reading the file.
Method Detail

getHeight

public int getHeight()
Get the height of the PPM image.

Returns:
the height of the image.

getWidth

public int getWidth()
Get the width of the PPM image.

Returns:
the width of the image.

getBytes

public byte[] getBytes()
Get the data as byte array. Data is of any type that has been read from the file (usually 8bit RGB)

Returns:
The data of the image.

getDouble

public double[] getDouble()
Get the data as double array. Data is of any type that has been read from the file (usually 8bit RGB put into an 64bit double)

Returns:
The data of the image.

writeImage

public static void writeImage(java.lang.String fn,
                              byte[] data,
                              int width,
                              int height)
                       throws java.io.FileNotFoundException,
                              java.io.IOException
Write to <code>fn</code> file the <code>data</code> using the <code>width, height</code> variables. Data is assumed to be 8bit RGB.

Throws:
java.io.FileNotFoundException - if the directory/image specified is wrong
java.io.IOException - if there are problems reading the file.