org.pdfbox.pdmodel.graphics.xobject
Class PDJpeg

java.lang.Object
  extended byorg.pdfbox.pdmodel.graphics.xobject.PDXObject
      extended byorg.pdfbox.pdmodel.graphics.xobject.PDXObjectImage
          extended byorg.pdfbox.pdmodel.graphics.xobject.PDJpeg
All Implemented Interfaces:
COSObjectable

public class PDJpeg
extends PDXObjectImage

An image class for JPegs.

Version:
$Revision: 1.5 $
Author:
mathiak

Field Summary
 
Fields inherited from class org.pdfbox.pdmodel.graphics.xobject.PDXObjectImage
SUB_TYPE
 
Constructor Summary
PDJpeg(PDDocument doc, BufferedImage bi)
          Construct from a buffered image.
PDJpeg(PDDocument doc, InputStream is)
          Construct from a stream.
PDJpeg(PDStream jpeg)
          Standard constructor.
 
Method Summary
 BufferedImage getRGBImage()
          Returns an image of the JPeg, or null if JPegs are not supported.
 void write2OutputStream(OutputStream out)
          This writes the JPeg to out.
 
Methods inherited from class org.pdfbox.pdmodel.graphics.xobject.PDXObjectImage
getBitsPerComponent, getColorSpace, getHeight, getSuffix, getWidth, setBitsPerComponent, setColorSpace, setHeight, setWidth, write2file
 
Methods inherited from class org.pdfbox.pdmodel.graphics.xobject.PDXObject
createXObject, getCOSObject, getCOSStream, getMetadata, getPDStream, setMetadata
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PDJpeg

public PDJpeg(PDStream jpeg)
Standard constructor.

Parameters:
jpeg - The COSStream from which to extract the JPeg

PDJpeg

public PDJpeg(PDDocument doc,
              InputStream is)
       throws IOException
Construct from a stream.

Parameters:
doc - The document to create the image as part of.
is - The stream that contains the jpeg data.
Throws:
IOException - If there is an error reading the jpeg data.

PDJpeg

public PDJpeg(PDDocument doc,
              BufferedImage bi)
       throws IOException
Construct from a buffered image.

Parameters:
doc - The document to create the image as part of.
bi - The image to convert to a jpeg
Throws:
IOException - If there is an error processing the jpeg data.
Method Detail

getRGBImage

public BufferedImage getRGBImage()
                          throws IOException
Returns an image of the JPeg, or null if JPegs are not supported. (They should be. ) Returns an java.awt.Image, that can be used for display etc.

Specified by:
getRGBImage in class PDXObjectImage
Returns:
This PDF object as an AWT image.
Throws:
IOException - If there is an error creating the image.

write2OutputStream

public void write2OutputStream(OutputStream out)
                        throws IOException
This writes the JPeg to out. Writes the Image to out.

Specified by:
write2OutputStream in class PDXObjectImage
Parameters:
out - the OutputStream that the Image is written to.
Throws:
IOException - when somethings wrong with out