public class JpegSegmentData extends Object
Segments are keyed via their JpegSegmentType
. Where multiple segments use the
same segment type, they will all be stored and available.
Each segment type may contain multiple entries. Conceptually the model is:
Map<JpegSegmentType, Collection<byte[]>>
. This class provides
convenience methods around that structure.
Constructor and Description |
---|
JpegSegmentData() |
Modifier and Type | Method and Description |
---|---|
void |
addSegment(byte segmentType,
byte[] segmentBytes)
Adds segment bytes to the collection.
|
boolean |
containsSegment(byte segmentType)
Determines whether data is present for a given segment type.
|
boolean |
containsSegment(JpegSegmentType segmentType)
Determines whether data is present for a given segment type.
|
byte[] |
getSegment(byte segmentType)
Gets the first JPEG segment data for the specified type.
|
byte[] |
getSegment(byte segmentType,
int occurrence)
Gets segment data for a specific occurrence and type.
|
byte[] |
getSegment(JpegSegmentType segmentType)
Gets the first JPEG segment data for the specified type.
|
byte[] |
getSegment(JpegSegmentType segmentType,
int occurrence)
Gets segment data for a specific occurrence and type.
|
int |
getSegmentCount(byte segmentType)
Returns the count of segment data byte arrays stored for a given segment type.
|
int |
getSegmentCount(JpegSegmentType segmentType)
Returns the count of segment data byte arrays stored for a given segment type.
|
Iterable<byte[]> |
getSegments(byte segmentType)
Returns all instances of a given JPEG segment.
|
Iterable<byte[]> |
getSegments(JpegSegmentType segmentType)
Returns all instances of a given JPEG segment.
|
Iterable<JpegSegmentType> |
getSegmentTypes()
Gets the set of JPEG segment type identifiers.
|
void |
removeSegment(byte segmentType)
Removes all segments from the collection having the specified type.
|
void |
removeSegment(JpegSegmentType segmentType)
Removes all segments from the collection having the specified type.
|
void |
removeSegmentOccurrence(byte segmentType,
int occurrence)
Removes a specified instance of a segment's data from the collection.
|
void |
removeSegmentOccurrence(JpegSegmentType segmentType,
int occurrence)
Removes a specified instance of a segment's data from the collection.
|
public void addSegment(byte segmentType, byte[] segmentBytes)
segmentType
- the type of the segment being addedsegmentBytes
- the byte array holding data for the segment being addedpublic Iterable<JpegSegmentType> getSegmentTypes()
public byte[] getSegment(byte segmentType)
segmentType
- the JpegSegmentType for the desired segmentpublic byte[] getSegment(JpegSegmentType segmentType)
segmentType
- the JpegSegmentType for the desired segmentpublic byte[] getSegment(JpegSegmentType segmentType, int occurrence)
segmentType
- identifies the required segmentoccurrence
- the zero-based index of the occurrencepublic byte[] getSegment(byte segmentType, int occurrence)
segmentType
- identifies the required segmentoccurrence
- the zero-based index of the occurrencepublic Iterable<byte[]> getSegments(JpegSegmentType segmentType)
segmentType
- a number which identifies the type of JPEG segment being queriedpublic Iterable<byte[]> getSegments(byte segmentType)
segmentType
- a number which identifies the type of JPEG segment being queriedpublic int getSegmentCount(JpegSegmentType segmentType)
segmentType
- identifies the required segmentpublic int getSegmentCount(byte segmentType)
segmentType
- identifies the required segmentpublic void removeSegmentOccurrence(JpegSegmentType segmentType, int occurrence)
segmentType
- identifies the required segmentoccurrence
- the zero-based index of the segment occurrence to remove.public void removeSegmentOccurrence(byte segmentType, int occurrence)
segmentType
- identifies the required segmentoccurrence
- the zero-based index of the segment occurrence to remove.public void removeSegment(JpegSegmentType segmentType)
segmentType
- identifies the required segmentpublic void removeSegment(byte segmentType)
segmentType
- identifies the required segmentpublic boolean containsSegment(JpegSegmentType segmentType)
segmentType
- identifies the required segmentpublic boolean containsSegment(byte segmentType)
segmentType
- identifies the required segmentCopyright © 2002-2020 Drew Noakes. All Rights Reserved.