|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.drew.imaging.jpeg.JpegSegmentData
public class JpegSegmentData
Holds a collection of Jpeg data segments. This need not necessarily be all segments within the Jpeg. For example, it may be convenient to store only the non-image segments when analysing (or serializing) metadata. Segments are keyed via their segment marker (a byte). Where multiple segments use the same segment marker, they will all be stored and available.
| Field Summary | |
|---|---|
private HashMap |
_segmentDataMap
A map of byte[], keyed by the segment marker |
(package private) static long |
serialVersionUID
|
| Constructor Summary | |
|---|---|
JpegSegmentData()
Creates a new JpegSegmentData collection object. |
|
| Method Summary | |
|---|---|
void |
addSegment(byte segmentMarker,
byte[] segmentBytes)
Adds segment bytes to the collection. |
boolean |
containsSegment(byte segmentMarker)
Determines whether data is present for a given segment marker. |
static JpegSegmentData |
FromFile(File file)
Deserialises the contents of a JpegSegmentData from a file. |
private List |
getOrCreateSegmentList(byte segmentMarker)
|
byte[] |
getSegment(byte segmentMarker)
Gets the first Jpeg segment data for the specified marker. |
byte[] |
getSegment(byte segmentMarker,
int occurrence)
Gets segment data for a specific occurrence and marker. |
int |
getSegmentCount(byte segmentMarker)
Returns the count of segment data byte arrays stored for a given segment marker. |
private List |
getSegmentList(byte segmentMarker)
|
void |
removeSegment(byte segmentMarker)
Removes all segments from the collection having the specified marker. |
void |
removeSegmentOccurrence(byte segmentMarker,
int occurrence)
Removes a specified instance of a segment's data from the collection. |
static void |
ToFile(File file,
JpegSegmentData segmentData)
Serialises the contents of a JpegSegmentData to a file. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
static final long serialVersionUID
private final HashMap _segmentDataMap
| Constructor Detail |
|---|
public JpegSegmentData()
| Method Detail |
|---|
public void addSegment(byte segmentMarker,
byte[] segmentBytes)
segmentMarker - segmentBytes - public byte[] getSegment(byte segmentMarker)
segmentMarker - the byte identifier for the desired segment
public byte[] getSegment(byte segmentMarker,
int occurrence)
segmentMarker - identifies the required segmentoccurrence - the zero-based index of the occurrence
public int getSegmentCount(byte segmentMarker)
segmentMarker - identifies the required segment
public void removeSegmentOccurrence(byte segmentMarker,
int occurrence)
segmentMarker - identifies the required segmentoccurrence - the zero-based index of the segment occurrence to remove.public void removeSegment(byte segmentMarker)
segmentMarker - identifies the required segmentpublic boolean containsSegment(byte segmentMarker)
segmentMarker - identifies the required segment
public static void ToFile(File file,
JpegSegmentData segmentData)
throws IOException
file - to file to write fromsegmentData - the data to write
IOException - if problems occur while writing
public static JpegSegmentData FromFile(File file)
throws IOException,
ClassNotFoundException
file - the file to read from
IOException - if problems occur while reading
ClassNotFoundException - if problems occur while deserialisingprivate List getSegmentList(byte segmentMarker)
private List getOrCreateSegmentList(byte segmentMarker)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||