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 classprivate static classprivate static class -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) static StringasAsciiString(byte[] data, int offset, int length) (package private) static StringasNullTerminatedAsciiString(byte[] data, int offset) private static booleancontainsSafe(JPEGSegment segment, Map<Integer, List<String>> segmentIdentifiers) private static booleanisImageDone(JPEGSegment segment) static booleanisKnownJPEGMarker(int marker) private static booleanisRequested(JPEGSegment segment, Map<Integer, List<String>> segmentIdentifiers) static void(package private) static JPEGSegmentreadSegment(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 voidreadSOI(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, ornullto 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 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.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
-