org.apache.fop.image.analyser
Class JPEGReader

java.lang.Object
  extended by org.apache.fop.image.analyser.AbstractImageReader
      extended by org.apache.fop.image.analyser.JPEGReader
All Implemented Interfaces:
ImageReader

public class JPEGReader
extends AbstractImageReader

ImageReader object for JPEG image type.

Version:
1.0
Author:
Pankaj Narula

Field Summary
protected static int APP0
           
protected static int APPF
           
protected  byte[] header
           
protected static int JPG_SIG_LENGTH
           
protected static int MARK
          Only SOFn and APPn markers are defined as SOFn is needed for the height and width search.
protected static int NULL
           
protected static int SOF1
           
protected static int SOF2
           
protected static int SOF3
           
protected static int SOFA
           
protected static int SOI
           
protected static int SOS
           
 
Fields inherited from class org.apache.fop.image.analyser.AbstractImageReader
height, imageStream, width
 
Constructor Summary
JPEGReader()
           
 
Method Summary
 String getMimeType()
          Return correspondig mime type.
protected  int read2bytes()
           
protected  void setDefaultHeader()
           
protected  void setDimension()
           
protected  long skip(long n)
           
 boolean verifySignature(String uri, BufferedInputStream fis)
          Verify image type.
 
Methods inherited from class org.apache.fop.image.analyser.AbstractImageReader
getHeight, getInputStream, getWidth
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MARK

protected static final int MARK
Only SOFn and APPn markers are defined as SOFn is needed for the height and width search. APPn is also defined because if the JPEG contains thumbnails the dimensions of the thumnail would also be after the SOFn marker enclosed inside the APPn marker. And we don't want to confuse those dimensions with the image dimensions.

See Also:
Constant Field Values

NULL

protected static final int NULL
See Also:
Constant Field Values

SOF1

protected static final int SOF1
See Also:
Constant Field Values

SOF2

protected static final int SOF2
See Also:
Constant Field Values

SOF3

protected static final int SOF3
See Also:
Constant Field Values

SOFA

protected static final int SOFA
See Also:
Constant Field Values

APP0

protected static final int APP0
See Also:
Constant Field Values

APPF

protected static final int APPF
See Also:
Constant Field Values

SOS

protected static final int SOS
See Also:
Constant Field Values

SOI

protected static final int SOI
See Also:
Constant Field Values

JPG_SIG_LENGTH

protected static final int JPG_SIG_LENGTH
See Also:
Constant Field Values

header

protected byte[] header
Constructor Detail

JPEGReader

public JPEGReader()
Method Detail

verifySignature

public boolean verifySignature(String uri,
                               BufferedInputStream fis)
                        throws IOException
Description copied from interface: ImageReader
Verify image type.

Specified by:
verifySignature in interface ImageReader
Specified by:
verifySignature in class AbstractImageReader
fis - Image buffered input stream
Returns:
true if image type is the handled one
Throws:
IOException - io error

getMimeType

public String getMimeType()
Description copied from interface: ImageReader
Return correspondig mime type.

Specified by:
getMimeType in interface ImageReader
Specified by:
getMimeType in class AbstractImageReader
Returns:
image mime type

setDefaultHeader

protected void setDefaultHeader()
                         throws IOException
Throws:
IOException

setDimension

protected void setDimension()
                     throws IOException
Throws:
IOException

read2bytes

protected int read2bytes()
                  throws IOException
Throws:
IOException

skip

protected long skip(long n)
             throws IOException
Throws:
IOException


Copyright ? 1999-2003 Apache Software Foundation. All Rights Reserved.