Package gov.nih.mipav.model.file
Class MetadataExtractor.JpegSegmentReader
- java.lang.Object
-
- gov.nih.mipav.model.file.MetadataExtractor.JpegSegmentReader
-
- Enclosing class:
- MetadataExtractor
public static class MetadataExtractor.JpegSegmentReader extends java.lang.ObjectPerforms read functions of JPEG files, returning specific file segments.JPEG files are composed of a sequence of consecutive JPEG 'segments'. Each is identified by one of a set of byte values, modelled in the
MetadataExtractor.JpegSegmentTypeenumeration. UsereadSegmentsto read out the some or all segments into aMetadataExtractor.JpegSegmentDataobject, from which the raw JPEG segment byte arrays may be accessed.- Author:
- Drew Noakes https://drewnoakes.com
-
-
Field Summary
Fields Modifier and Type Field Description private static byteMARKER_EOIPrivate, because one wouldn't search for it.private static byteSEGMENT_IDENTIFIERThe 0xFF byte that signals the start of a segment.private static byteSEGMENT_SOSPrivate, because this segment crashes my algorithm, and searching for it doesn't work (yet).
-
Constructor Summary
Constructors Modifier Constructor Description privateJpegSegmentReader()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static MetadataExtractor.JpegSegmentDatareadSegments(MetadataExtractor.SequentialReader reader, java.lang.Iterable<MetadataExtractor.JpegSegmentType> segmentTypes)Processes the provided JPEG data, and extracts the specified JPEG segments into aMetadataExtractor.JpegSegmentDataobject.static MetadataExtractor.JpegSegmentDatareadSegments(java.io.File file, java.lang.Iterable<MetadataExtractor.JpegSegmentType> segmentTypes)Processes the provided JPEG data, and extracts the specified JPEG segments into aMetadataExtractor.JpegSegmentDataobject.
-
-
-
Field Detail
-
SEGMENT_IDENTIFIER
private static final byte SEGMENT_IDENTIFIER
The 0xFF byte that signals the start of a segment.- See Also:
- Constant Field Values
-
SEGMENT_SOS
private static final byte SEGMENT_SOS
Private, because this segment crashes my algorithm, and searching for it doesn't work (yet).- See Also:
- Constant Field Values
-
MARKER_EOI
private static final byte MARKER_EOI
Private, because one wouldn't search for it.- See Also:
- Constant Field Values
-
-
Method Detail
-
readSegments
public static MetadataExtractor.JpegSegmentData readSegments(java.io.File file, java.lang.Iterable<MetadataExtractor.JpegSegmentType> segmentTypes) throws MetadataExtractor.JpegProcessingException, java.io.IOException
Processes the provided JPEG data, and extracts the specified JPEG segments into aMetadataExtractor.JpegSegmentDataobject.Will not return SOS (start of scan) or EOI (end of image) segments.
- Parameters:
file- aFilefrom which the JPEG data will be read.segmentTypes- the set of JPEG segments types that are to be returned. If this argument isnullthen all found segment types are returned.- Throws:
MetadataExtractor.JpegProcessingExceptionjava.io.IOException
-
readSegments
public static MetadataExtractor.JpegSegmentData readSegments(MetadataExtractor.SequentialReader reader, java.lang.Iterable<MetadataExtractor.JpegSegmentType> segmentTypes) throws MetadataExtractor.JpegProcessingException, java.io.IOException
Processes the provided JPEG data, and extracts the specified JPEG segments into aMetadataExtractor.JpegSegmentDataobject.Will not return SOS (start of scan) or EOI (end of image) segments.
- Parameters:
reader- aMetadataExtractor.SequentialReaderfrom which the JPEG data will be read. It must be positioned at the beginning of the JPEG data stream.segmentTypes- the set of JPEG segments types that are to be returned. If this argument isnullthen all found segment types are returned.- Throws:
MetadataExtractor.JpegProcessingExceptionjava.io.IOException
-
-