Class JPEGSegmentUtil
java.lang.Object
com.twelvemonkeys.imageio.metadata.jpeg.JPEGSegmentUtil
JPEGSegmentUtil
- Version:
- $Id: JPEGSegmentUtil.java,v 1.0 24.01.11 17.37 haraldk Exp$
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static class
private static class
private static class
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) static String
asAsciiString
(byte[] data, int offset, int length) (package private) static String
asNullTerminatedAsciiString
(byte[] data, int offset) private static boolean
containsSafe
(JPEGSegment segment, Map<Integer, List<String>> segmentIdentifiers) private static boolean
isImageDone
(JPEGSegment segment) static boolean
isKnownJPEGMarker
(int marker) private static boolean
isRequested
(JPEGSegment segment, Map<Integer, List<String>> segmentIdentifiers) static void
(package private) static JPEGSegment
readSegment
(ImageInputStream stream, Map<Integer, List<String>> segmentIdentifiers) static List
<JPEGSegment> readSegments
(ImageInputStream stream, int marker, String identifier) Reads the requested JPEG segments from the stream.static List
<JPEGSegment> readSegments
(ImageInputStream stream, Map<Integer, List<String>> segmentIdentifiers) Reads the requested JPEG segments from the stream.(package private) static void
readSOI
(ImageInputStream stream)
-
Field Details
-
ALL_IDS
-
ALL_SEGMENTS
-
APP_SEGMENTS
-
-
Constructor Details
-
JPEGSegmentUtil
private JPEGSegmentUtil()
-
-
Method Details
-
readSegments
public static List<JPEGSegment> readSegments(ImageInputStream stream, int marker, String identifier) throws IOException Reads the requested JPEG segments from the stream. The stream position must be directly before the SOI marker, and only segments for the current image is read.- Parameters:
stream
- the stream to read from.marker
- the segment marker to readidentifier
- the identifier to read, ornull
to match any segment- Returns:
- a list of segments with the given app marker and optional identifier. If no segments are found, an empty list is returned.
- Throws:
IIOException
- if a JPEG format exception occurs during readingIOException
- if an I/O exception occurs during reading
-
readSegments
public static List<JPEGSegment> readSegments(ImageInputStream stream, Map<Integer, List<String>> segmentIdentifiers) throws IOExceptionReads the requested JPEG segments from the stream. The stream position must be directly before the SOI marker, and only segments for the current image is read.- Parameters:
stream
- the stream to read from.segmentIdentifiers
- the segment identifiers- Returns:
- a list of segments with the given app markers and optional identifiers. If no segments are found, an empty list is returned.
- Throws:
IIOException
- if a JPEG format exception occurs during readingIOException
- if an I/O exception occurs during reading- See Also:
-
isRequested
private static boolean isRequested(JPEGSegment segment, Map<Integer, List<String>> segmentIdentifiers) -
containsSafe
private static boolean containsSafe(JPEGSegment segment, Map<Integer, List<String>> segmentIdentifiers) -
isImageDone
-
asNullTerminatedAsciiString
-
asAsciiString
-
readSOI
- Throws:
IOException
-
readSegment
static JPEGSegment readSegment(ImageInputStream stream, Map<Integer, List<String>> segmentIdentifiers) throws IOException- Throws:
IOException
-
isKnownJPEGMarker
public static boolean isKnownJPEGMarker(int marker) -
main
- Throws:
IOException
-