com.drew.imaging.jpeg
Class JpegSegmentReader
java.lang.Object
com.drew.imaging.jpeg.JpegSegmentReader
public class JpegSegmentReader
extends java.lang.Object
Performs read functions of Jpeg files, returning specific file segments.
TODO add a findAvailableSegments() method
TODO add more segment identifiers
TODO add a getSegmentDescription() method, returning for example 'App1 application data segment, commonly containing Exif data'
- Drew Noakes http://drewnoakes.com
int | getSegmentCount(byte segmentMarker)
|
JpegSegmentData | getSegmentData()
|
byte[] | readSegment(byte segmentMarker) - Reads the first instance of a given Jpeg segment, returning the contents as
a byte array.
|
byte[] | readSegment(byte segmentMarker, int occurrence) - Reads the first instance of a given Jpeg segment, returning the contents as
a byte array.
|
SEGMENT_APP0
public static final byte SEGMENT_APP0
APP0 Jpeg segment identifier -- Jfif data.
SEGMENT_APP1
public static final byte SEGMENT_APP1
APP1 Jpeg segment identifier -- where Exif data is kept.
SEGMENT_APP2
public static final byte SEGMENT_APP2
APP2 Jpeg segment identifier.
SEGMENT_APP3
public static final byte SEGMENT_APP3
APP3 Jpeg segment identifier.
SEGMENT_APP4
public static final byte SEGMENT_APP4
APP4 Jpeg segment identifier.
SEGMENT_APP5
public static final byte SEGMENT_APP5
APP5 Jpeg segment identifier.
SEGMENT_APP6
public static final byte SEGMENT_APP6
APP6 Jpeg segment identifier.
SEGMENT_APP7
public static final byte SEGMENT_APP7
APP7 Jpeg segment identifier.
SEGMENT_APP8
public static final byte SEGMENT_APP8
APP8 Jpeg segment identifier.
SEGMENT_APP9
public static final byte SEGMENT_APP9
APP9 Jpeg segment identifier.
SEGMENT_APPA
public static final byte SEGMENT_APPA
APPA Jpeg segment identifier -- can hold Unicode comments.
SEGMENT_APPB
public static final byte SEGMENT_APPB
APPB Jpeg segment identifier.
SEGMENT_APPC
public static final byte SEGMENT_APPC
APPC Jpeg segment identifier.
SEGMENT_APPD
public static final byte SEGMENT_APPD
APPD Jpeg segment identifier -- IPTC data in here.
SEGMENT_APPE
public static final byte SEGMENT_APPE
APPE Jpeg segment identifier.
SEGMENT_APPF
public static final byte SEGMENT_APPF
APPF Jpeg segment identifier.
SEGMENT_COM
public static final byte SEGMENT_COM
Jpeg comment segment identifier.
SEGMENT_DHT
public static final byte SEGMENT_DHT
Define Huffman Table segment identifier.
SEGMENT_DQT
public static final byte SEGMENT_DQT
Define Quantization Table segment identifier.
SEGMENT_SOF0
public static final byte SEGMENT_SOF0
Start-of-Frame Zero segment identifier.
SEGMENT_SOI
public static final byte SEGMENT_SOI
Start Of Image segment identifier.
JpegSegmentReader
public JpegSegmentReader(File file)
throws JpegProcessingException
Creates a JpegSegmentReader for a specific file.
file
- the Jpeg file to read segments from
JpegSegmentReader
public JpegSegmentReader(byte[] fileContents)
throws JpegProcessingException
Creates a JpegSegmentReader for a byte array.
fileContents
- the byte array containing Jpeg data
getSegmentCount
public final int getSegmentCount(byte segmentMarker)
readSegment
public byte[] readSegment(byte segmentMarker)
throws JpegProcessingException
Reads the first instance of a given Jpeg segment, returning the contents as
a byte array.
segmentMarker
- the byte identifier for the desired segment
- the byte array if found, else null
readSegment
public byte[] readSegment(byte segmentMarker,
int occurrence)
Reads the first instance of a given Jpeg segment, returning the contents as
a byte array.
segmentMarker
- the byte identifier for the desired segmentoccurrence
- the occurrence of the specified segment within the jpeg file
- the byte array if found, else null
Copyright © 2006 Drew Noakes. All Rights Reserved.