public JpegPhotoshopMetadata getPhotoshopMetadata(ByteSource byteSource,
            Map params) throws ImageReadException, IOException
    {
        ArrayList segments = readSegments(byteSource,
                new int[] { JPEG_APP13_Marker, }, false);

        if ((segments == null) || (segments.size() < 1))
            return null;

        PhotoshopApp13Data photoshopApp13Data = null;

        for (int i = 0; i < segments.size(); i++)
        {
            App13Segment segment = (App13Segment) segments.get(i);

            PhotoshopApp13Data data = segment.parsePhotoshopSegment(params);
            if (data != null && photoshopApp13Data != null)
                throw new ImageReadException(
                        "Jpeg contains more than one Photoshop App13 segment.");

            photoshopApp13Data = data;
        }

        if(null==photoshopApp13Data)
            return null;
        return new JpegPhotoshopMetadata(photoshopApp13Data);
    }