Class JPEGSegmentUtil


  • public final class JPEGSegmentUtil
    extends java.lang.Object
    JPEGSegmentUtil
    Version:
    $Id: JPEGSegmentUtil.java,v 1.0 24.01.11 17.37 haraldk Exp$
    Author:
    Harald Kuhr, last modified by $Author: haraldk$
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.util.List<java.lang.String> ALL_IDS  
      static java.util.Map<java.lang.Integer,​java.util.List<java.lang.String>> ALL_SEGMENTS  
      static java.util.Map<java.lang.Integer,​java.util.List<java.lang.String>> APP_SEGMENTS  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static boolean isKnownJPEGMarker​(int marker)  
      static void main​(java.lang.String[] args)  
      static java.util.List<JPEGSegment> readSegments​(javax.imageio.stream.ImageInputStream stream, int marker, java.lang.String identifier)
      Reads the requested JPEG segments from the stream.
      static java.util.List<JPEGSegment> readSegments​(javax.imageio.stream.ImageInputStream stream, java.util.Map<java.lang.Integer,​java.util.List<java.lang.String>> segmentIdentifiers)
      Reads the requested JPEG segments from the stream.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • ALL_IDS

        public static final java.util.List<java.lang.String> ALL_IDS
      • ALL_SEGMENTS

        public static final java.util.Map<java.lang.Integer,​java.util.List<java.lang.String>> ALL_SEGMENTS
      • APP_SEGMENTS

        public static final java.util.Map<java.lang.Integer,​java.util.List<java.lang.String>> APP_SEGMENTS
    • Method Detail

      • readSegments

        public static java.util.List<JPEGSegment> readSegments​(javax.imageio.stream.ImageInputStream stream,
                                                               int marker,
                                                               java.lang.String identifier)
                                                        throws java.io.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 read
        identifier - the identifier to read, or null 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:
        javax.imageio.IIOException - if a JPEG format exception occurs during reading
        java.io.IOException - if an I/O exception occurs during reading
      • readSegments

        public static java.util.List<JPEGSegment> readSegments​(javax.imageio.stream.ImageInputStream stream,
                                                               java.util.Map<java.lang.Integer,​java.util.List<java.lang.String>> segmentIdentifiers)
                                                        throws java.io.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:
        javax.imageio.IIOException - if a JPEG format exception occurs during reading
        java.io.IOException - if an I/O exception occurs during reading
        See Also:
        ALL_SEGMENTS, APP_SEGMENTS, ALL_IDS
      • isKnownJPEGMarker

        public static boolean isKnownJPEGMarker​(int marker)
      • main

        public static void main​(java.lang.String[] args)
                         throws java.io.IOException
        Throws:
        java.io.IOException