|
|||||||||
| Home >> All >> com >> drew >> imaging >> [ jpeg overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
com.drew.imaging.jpeg
Class JpegSegmentReader

java.lang.Objectcom.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'
| Field Summary | |
private byte[] |
_data
Jpeg data as byte array. |
private java.io.File |
_file
Jpeg file. |
private java.util.HashMap |
_segmentDataMap
|
private java.io.InputStream |
_stream
Jpeg data as an InputStream. |
private static byte |
MARKER_EOI
Private, because one wouldn't search for it. |
static byte |
SEGMENT_APP0
APP0 Jpeg segment identifier -- Jfif data. |
static byte |
SEGMENT_APP1
APP1 Jpeg segment identifier -- where Exif data is kept. |
static byte |
SEGMENT_APP2
APP2 Jpeg segment identifier. |
static byte |
SEGMENT_APP3
APP3 Jpeg segment identifier. |
static byte |
SEGMENT_APP4
APP4 Jpeg segment identifier. |
static byte |
SEGMENT_APP5
APP5 Jpeg segment identifier. |
static byte |
SEGMENT_APP6
APP6 Jpeg segment identifier. |
static byte |
SEGMENT_APP7
APP7 Jpeg segment identifier. |
static byte |
SEGMENT_APP8
APP8 Jpeg segment identifier. |
static byte |
SEGMENT_APP9
APP9 Jpeg segment identifier. |
static byte |
SEGMENT_APPA
APPA Jpeg segment identifier. |
static byte |
SEGMENT_APPB
APPB Jpeg segment identifier. |
static byte |
SEGMENT_APPC
APPC Jpeg segment identifier. |
static byte |
SEGMENT_APPD
APPD Jpeg segment identifier -- IPTC data in here. |
static byte |
SEGMENT_APPE
APPE Jpeg segment identifier. |
static byte |
SEGMENT_APPF
APPF Jpeg segment identifier. |
static byte |
SEGMENT_DHT
Define Huffman Table segment identifier. |
static byte |
SEGMENT_DQT
Define Quantization Table segment identifier. |
static byte |
SEGMENT_SOF0
Start-of-Frame Zero segment identifier. |
static byte |
SEGMENT_SOI
Start Of Image segment identifier. |
private static byte |
SEGMENT_SOS
Private, because this segment crashes my algorithm, and searching for it doesn't work (yet). |
| Constructor Summary | |
JpegSegmentReader(byte[] fileContents)
Creates a JpegSegmentReader for a byte array. |
|
JpegSegmentReader(java.io.File file)
Creates a JpegSegmentReader for a specific file. |
|
JpegSegmentReader(java.io.InputStream in)
|
|
| Method Summary | |
private java.io.BufferedInputStream |
getJpegInputStream()
Private helper method to create a BufferedInputStream of Jpeg data from whichever data source was specified upon construction of this instance. |
int |
getSegmentCount(byte segmentMarker)
|
private boolean |
isValidJpegHeaderBytes(java.io.InputStream fileStream)
Helper method that validates the Jpeg file's magic number. |
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. |
private void |
readSegments()
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
_file
private java.io.File _file
- Jpeg file.
_data
private byte[] _data
- Jpeg data as byte array.
_stream
private java.io.InputStream _stream
- Jpeg data as an InputStream.
_segmentDataMap
private java.util.HashMap _segmentDataMap
SEGMENT_SOS
private static byte SEGMENT_SOS
- Private, because this segment crashes my algorithm, and searching for
it doesn't work (yet).
MARKER_EOI
private static byte MARKER_EOI
- Private, because one wouldn't search for it.
SEGMENT_APP0
public static final byte SEGMENT_APP0
- APP0 Jpeg segment identifier -- Jfif data.
- See Also:
- Constant Field Values
SEGMENT_APP1
public static final byte SEGMENT_APP1
- APP1 Jpeg segment identifier -- where Exif data is kept.
- See Also:
- Constant Field Values
SEGMENT_APP2
public static final byte SEGMENT_APP2
- APP2 Jpeg segment identifier.
- See Also:
- Constant Field Values
SEGMENT_APP3
public static final byte SEGMENT_APP3
- APP3 Jpeg segment identifier.
- See Also:
- Constant Field Values
SEGMENT_APP4
public static final byte SEGMENT_APP4
- APP4 Jpeg segment identifier.
- See Also:
- Constant Field Values
SEGMENT_APP5
public static final byte SEGMENT_APP5
- APP5 Jpeg segment identifier.
- See Also:
- Constant Field Values
SEGMENT_APP6
public static final byte SEGMENT_APP6
- APP6 Jpeg segment identifier.
- See Also:
- Constant Field Values
SEGMENT_APP7
public static final byte SEGMENT_APP7
- APP7 Jpeg segment identifier.
- See Also:
- Constant Field Values
SEGMENT_APP8
public static final byte SEGMENT_APP8
- APP8 Jpeg segment identifier.
- See Also:
- Constant Field Values
SEGMENT_APP9
public static final byte SEGMENT_APP9
- APP9 Jpeg segment identifier.
- See Also:
- Constant Field Values
SEGMENT_APPA
public static final byte SEGMENT_APPA
- APPA Jpeg segment identifier.
- See Also:
- Constant Field Values
SEGMENT_APPB
public static final byte SEGMENT_APPB
- APPB Jpeg segment identifier.
- See Also:
- Constant Field Values
SEGMENT_APPC
public static final byte SEGMENT_APPC
- APPC Jpeg segment identifier.
- See Also:
- Constant Field Values
SEGMENT_APPD
public static final byte SEGMENT_APPD
- APPD Jpeg segment identifier -- IPTC data in here.
- See Also:
- Constant Field Values
SEGMENT_APPE
public static final byte SEGMENT_APPE
- APPE Jpeg segment identifier.
- See Also:
- Constant Field Values
SEGMENT_APPF
public static final byte SEGMENT_APPF
- APPF Jpeg segment identifier.
- See Also:
- Constant Field Values
SEGMENT_SOI
public static final byte SEGMENT_SOI
- Start Of Image segment identifier.
- See Also:
- Constant Field Values
SEGMENT_DQT
public static final byte SEGMENT_DQT
- Define Quantization Table segment identifier.
- See Also:
- Constant Field Values
SEGMENT_DHT
public static final byte SEGMENT_DHT
- Define Huffman Table segment identifier.
- See Also:
- Constant Field Values
SEGMENT_SOF0
public static final byte SEGMENT_SOF0
- Start-of-Frame Zero segment identifier.
- See Also:
- Constant Field Values
| Constructor Detail |
JpegSegmentReader
public JpegSegmentReader(java.io.File file) throws java.io.FileNotFoundException, JpegProcessingException
- Creates a JpegSegmentReader for a specific file.
JpegSegmentReader
public JpegSegmentReader(byte[] fileContents)
throws JpegProcessingException
- Creates a JpegSegmentReader for a byte array.
JpegSegmentReader
public JpegSegmentReader(java.io.InputStream in) throws JpegProcessingException
| Method Detail |
readSegment
public byte[] readSegment(byte segmentMarker)
throws JpegProcessingException
- Reads the first instance of a given Jpeg segment, returning the contents as
a byte array.
readSegment
public byte[] readSegment(byte segmentMarker,
int occurrence)
throws JpegProcessingException
- Reads the first instance of a given Jpeg segment, returning the contents as
a byte array.
getSegmentCount
public int getSegmentCount(byte segmentMarker)
readSegments
private void readSegments()
throws JpegProcessingException
getJpegInputStream
private java.io.BufferedInputStream getJpegInputStream() throws JpegProcessingException
- Private helper method to create a BufferedInputStream of Jpeg data from whichever
data source was specified upon construction of this instance.
isValidJpegHeaderBytes
private boolean isValidJpegHeaderBytes(java.io.InputStream fileStream) throws java.io.IOException
- Helper method that validates the Jpeg file's magic number.
|
|||||||||
| Home >> All >> com >> drew >> imaging >> [ jpeg overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC
com.drew.imaging.jpeg.JpegSegmentReader