org.w3c.tools.jpeg
Class JpegHeaders

java.lang.Object
  extended by org.w3c.tools.jpeg.JpegHeaders
All Implemented Interfaces:
Jpeg

public class JpegHeaders
extends java.lang.Object
implements Jpeg


Field Summary
protected  byte[][] appcomments
           
protected  int bitsPerPixel
           
protected  java.lang.String[] comments
           
protected  int compression
           
protected  Exif exif
           
protected  int height
           
protected  java.io.InputStream in
           
protected  java.io.File jpegfile
           
protected  int numComponents
           
protected  java.util.Vector[] vacom
           
protected  java.util.Vector vcom
           
protected  int width
           
 
Fields inherited from interface org.w3c.tools.jpeg.Jpeg
M_APP0, M_APP1, M_APP10, M_APP11, M_APP12, M_APP13, M_APP14, M_APP15, M_APP2, M_APP3, M_APP4, M_APP5, M_APP6, M_APP7, M_APP8, M_APP9, M_COM, M_EOI, M_MAX_COM_LENGTH, M_SOF0, M_SOF1, M_SOF10, M_SOF11, M_SOF13, M_SOF14, M_SOF15, M_SOF2, M_SOF3, M_SOF5, M_SOF6, M_SOF7, M_SOF9, M_SOI, M_SOS
 
Constructor Summary
JpegHeaders(java.io.File jpegfile)
          get the headers out of a file, ignoring EXIF
JpegHeaders(java.io.File jpegfile, Exif exif)
          get the headers out of a file, including EXIF
JpegHeaders(java.io.InputStream in)
          get the headers out of a stream, ignoring EXIF
JpegHeaders(java.io.InputStream in, Exif exif)
          get the headers out of a stream, including EXIF
 
Method Summary
protected  int firstMarker()
           
 java.lang.String[] getAppComments()
          Deprecated. use getStringAppComments instead
 byte[][] getByteArrayAPPComment()
           
 java.lang.String[] getComments()
          Get the comments extracted from the jpeg stream
 java.lang.String[] getStringAppComments()
          An old default, it gets only the M_APP12
 java.lang.String[] getStringAPPComments(int marker)
          Get the application specific values extracted from the jpeg stream
 java.lang.String getXMP()
          A get XMP in APP1
static void main(java.lang.String[] args)
           
protected  int nextMarker()
           
protected  void parseJpeg(java.io.File jpegfile, Exif exif)
           
protected  byte[] processComment()
           
protected  int read2bytes()
           
protected  int read2bytes(java.io.StringReader sr)
           
protected  void readImageInfo()
          read the image info then the section
protected  int scanHeaders()
           
protected  void skipVariable()
          skip the body after a marker
protected  void updateExif()
          Update the EXIF to include the intrinsic values
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

jpegfile

protected java.io.File jpegfile

in

protected java.io.InputStream in

vcom

protected java.util.Vector vcom

vacom

protected java.util.Vector[] vacom

comments

protected java.lang.String[] comments

appcomments

protected byte[][] appcomments

exif

protected Exif exif

compression

protected int compression

bitsPerPixel

protected int bitsPerPixel

height

protected int height

width

protected int width

numComponents

protected int numComponents
Constructor Detail

JpegHeaders

public JpegHeaders(java.io.File jpegfile)
            throws java.io.FileNotFoundException,
                   JpegException,
                   java.io.IOException
get the headers out of a file, ignoring EXIF

Throws:
java.io.FileNotFoundException
JpegException
java.io.IOException

JpegHeaders

public JpegHeaders(java.io.File jpegfile,
                   Exif exif)
            throws java.io.FileNotFoundException,
                   JpegException,
                   java.io.IOException
get the headers out of a file, including EXIF

Throws:
java.io.FileNotFoundException
JpegException
java.io.IOException

JpegHeaders

public JpegHeaders(java.io.InputStream in)
            throws JpegException,
                   java.io.IOException
get the headers out of a stream, ignoring EXIF

Throws:
JpegException
java.io.IOException

JpegHeaders

public JpegHeaders(java.io.InputStream in,
                   Exif exif)
            throws JpegException,
                   java.io.IOException
get the headers out of a stream, including EXIF

Throws:
JpegException
java.io.IOException
Method Detail

getComments

public java.lang.String[] getComments()
Get the comments extracted from the jpeg stream

Returns:
an array of Strings

getStringAPPComments

public java.lang.String[] getStringAPPComments(int marker)
Get the application specific values extracted from the jpeg stream

Returns:
an array of Strings

getStringAppComments

public java.lang.String[] getStringAppComments()
An old default, it gets only the M_APP12


getXMP

public java.lang.String getXMP()
                        throws java.io.IOException,
                               JpegException
A get XMP in APP1

Throws:
java.io.IOException
JpegException

getByteArrayAPPComment

public byte[][] getByteArrayAPPComment()

getAppComments

public java.lang.String[] getAppComments()
Deprecated. use getStringAppComments instead

The old way of extracting comments in M_APP12 markers


scanHeaders

protected int scanHeaders()
                   throws java.io.IOException,
                          JpegException
Throws:
java.io.IOException
JpegException

updateExif

protected void updateExif()
Update the EXIF to include the intrinsic values


processComment

protected byte[] processComment()
                         throws java.io.IOException,
                                JpegException
Throws:
java.io.IOException
JpegException

read2bytes

protected int read2bytes()
                  throws java.io.IOException,
                         JpegException
Throws:
java.io.IOException
JpegException

read2bytes

protected int read2bytes(java.io.StringReader sr)
                  throws java.io.IOException,
                         JpegException
Throws:
java.io.IOException
JpegException

skipVariable

protected void skipVariable()
                     throws java.io.IOException,
                            JpegException
skip the body after a marker

Throws:
java.io.IOException
JpegException

readImageInfo

protected void readImageInfo()
                      throws java.io.IOException,
                             JpegException
read the image info then the section

Throws:
java.io.IOException
JpegException

firstMarker

protected int firstMarker()
                   throws java.io.IOException,
                          JpegException
Throws:
java.io.IOException
JpegException

nextMarker

protected int nextMarker()
                  throws java.io.IOException
Throws:
java.io.IOException

parseJpeg

protected void parseJpeg(java.io.File jpegfile,
                         Exif exif)
                  throws java.io.FileNotFoundException,
                         JpegException,
                         java.io.IOException
Throws:
java.io.FileNotFoundException
JpegException
java.io.IOException

main

public static void main(java.lang.String[] args)