Index: trunk/src/com/drew/imaging/ImageProcessingException.java
===================================================================
--- trunk/src/com/drew/imaging/ImageProcessingException.java	(revision 15218)
+++ 	(revision )
@@ -1,49 +1,0 @@
-/*
- * Copyright 2002-2019 Drew Noakes and contributors
- *
- *    Licensed under the Apache License, Version 2.0 (the "License");
- *    you may not use this file except in compliance with the License.
- *    You may obtain a copy of the License at
- *
- *        http://www.apache.org/licenses/LICENSE-2.0
- *
- *    Unless required by applicable law or agreed to in writing, software
- *    distributed under the License is distributed on an "AS IS" BASIS,
- *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *    See the License for the specific language governing permissions and
- *    limitations under the License.
- *
- * More information about this project is available at:
- *
- *    https://drewnoakes.com/code/exif/
- *    https://github.com/drewnoakes/metadata-extractor
- */
-package com.drew.imaging;
-
-import com.drew.lang.CompoundException;
-import com.drew.lang.annotations.Nullable;
-
-/**
- * An exception class thrown upon an unexpected condition that was fatal for the processing of an image.
- *
- * @author Drew Noakes https://drewnoakes.com
- */
-public class ImageProcessingException extends CompoundException
-{
-    private static final long serialVersionUID = -9115669182209912676L;
-
-    public ImageProcessingException(@Nullable String message)
-    {
-        super(message);
-    }
-
-    public ImageProcessingException(@Nullable String message, @Nullable Throwable cause)
-    {
-        super(message, cause);
-    }
-
-    public ImageProcessingException(@Nullable Throwable cause)
-    {
-        super(cause);
-    }
-}
Index: trunk/src/com/drew/imaging/PhotographicConversions.java
===================================================================
--- trunk/src/com/drew/imaging/PhotographicConversions.java	(revision 15218)
+++ 	(revision )
@@ -1,61 +1,0 @@
-/*
- * Copyright 2002-2019 Drew Noakes and contributors
- *
- *    Licensed under the Apache License, Version 2.0 (the "License");
- *    you may not use this file except in compliance with the License.
- *    You may obtain a copy of the License at
- *
- *        http://www.apache.org/licenses/LICENSE-2.0
- *
- *    Unless required by applicable law or agreed to in writing, software
- *    distributed under the License is distributed on an "AS IS" BASIS,
- *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *    See the License for the specific language governing permissions and
- *    limitations under the License.
- *
- * More information about this project is available at:
- *
- *    https://drewnoakes.com/code/exif/
- *    https://github.com/drewnoakes/metadata-extractor
- */
-package com.drew.imaging;
-
-/**
- * Contains helper methods that perform photographic conversions.
- *
- * @author Drew Noakes https://drewnoakes.com
- */
-public final class PhotographicConversions
-{
-    public final static double ROOT_TWO = Math.sqrt(2);
-
-    private PhotographicConversions() throws Exception
-    {
-        throw new Exception("Not intended for instantiation.");
-    }
-
-    /**
-     * Converts an aperture value to its corresponding F-stop number.
-     *
-     * @param aperture the aperture value to convert
-     * @return the F-stop number of the specified aperture
-     */
-    public static double apertureToFStop(double aperture)
-    {
-        return Math.pow(ROOT_TWO, aperture);
-
-        // NOTE jhead uses a different calculation as far as i can tell...  this confuses me...
-        // fStop = (float)Math.exp(aperture * Math.log(2) * 0.5));
-    }
-
-    /**
-     * Converts a shutter speed to an exposure time.
-     *
-     * @param shutterSpeed the shutter speed to convert
-     * @return the exposure time of the specified shutter speed
-     */
-    public static double shutterSpeedToExposureTime(double shutterSpeed)
-    {
-        return (float) (1 / Math.exp(shutterSpeed * Math.log(2)));
-    }
-}
Index: trunk/src/com/drew/imaging/jpeg/JpegMetadataReader.java
===================================================================
--- trunk/src/com/drew/imaging/jpeg/JpegMetadataReader.java	(revision 15218)
+++ 	(revision )
@@ -1,143 +1,0 @@
-/*
- * Copyright 2002-2019 Drew Noakes and contributors
- *
- *    Licensed under the Apache License, Version 2.0 (the "License");
- *    you may not use this file except in compliance with the License.
- *    You may obtain a copy of the License at
- *
- *        http://www.apache.org/licenses/LICENSE-2.0
- *
- *    Unless required by applicable law or agreed to in writing, software
- *    distributed under the License is distributed on an "AS IS" BASIS,
- *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *    See the License for the specific language governing permissions and
- *    limitations under the License.
- *
- * More information about this project is available at:
- *
- *    https://drewnoakes.com/code/exif/
- *    https://github.com/drewnoakes/metadata-extractor
- */
-package com.drew.imaging.jpeg;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.Arrays;
-import java.util.HashSet;
-import java.util.Set;
-
-import com.drew.lang.StreamReader;
-import com.drew.lang.annotations.NotNull;
-import com.drew.lang.annotations.Nullable;
-import com.drew.metadata.Metadata;
-//import com.drew.metadata.adobe.AdobeJpegReader;
-import com.drew.metadata.exif.ExifReader;
-import com.drew.metadata.file.FileSystemMetadataReader;
-import com.drew.metadata.icc.IccReader;
-import com.drew.metadata.iptc.IptcReader;
-//import com.drew.metadata.jfif.JfifReader;
-//import com.drew.metadata.jfxx.JfxxReader;
-import com.drew.metadata.jpeg.JpegCommentReader;
-import com.drew.metadata.jpeg.JpegDhtReader;
-import com.drew.metadata.jpeg.JpegDnlReader;
-import com.drew.metadata.jpeg.JpegReader;
-import com.drew.metadata.photoshop.DuckyReader;
-import com.drew.metadata.photoshop.PhotoshopReader;
-//import com.drew.metadata.xmp.XmpReader;
-
-/**
- * Obtains all available metadata from JPEG formatted files.
- *
- * @author Drew Noakes https://drewnoakes.com
- */
-public class JpegMetadataReader
-{
-    public static final Iterable<JpegSegmentMetadataReader> ALL_READERS = Arrays.asList(
-            new JpegReader(),
-            new JpegCommentReader(),
-            //new JfifReader(),
-            //new JfxxReader(),
-            new ExifReader(),
-            //new XmpReader(),
-            new IccReader(),
-            new PhotoshopReader(),
-            new DuckyReader(),
-            new IptcReader(),
-            //new AdobeJpegReader(),
-            new JpegDhtReader(),
-            new JpegDnlReader()
-    );
-
-    @NotNull
-    public static Metadata readMetadata(@NotNull InputStream inputStream, @Nullable Iterable<JpegSegmentMetadataReader> readers) throws JpegProcessingException, IOException
-    {
-        Metadata metadata = new Metadata();
-        process(metadata, inputStream, readers);
-        return metadata;
-    }
-
-    @NotNull
-    public static Metadata readMetadata(@NotNull InputStream inputStream) throws JpegProcessingException, IOException
-    {
-        return readMetadata(inputStream, null);
-    }
-
-    @NotNull
-    public static Metadata readMetadata(@NotNull File file, @Nullable Iterable<JpegSegmentMetadataReader> readers) throws JpegProcessingException, IOException
-    {
-        InputStream inputStream = new FileInputStream(file);
-        Metadata metadata;
-        try {
-            metadata = readMetadata(inputStream, readers);
-        } finally {
-            inputStream.close();
-        }
-        new FileSystemMetadataReader().read(file, metadata);
-        return metadata;
-    }
-
-    @NotNull
-    public static Metadata readMetadata(@NotNull File file) throws JpegProcessingException, IOException
-    {
-        return readMetadata(file, null);
-    }
-
-    public static void process(@NotNull Metadata metadata, @NotNull InputStream inputStream) throws JpegProcessingException, IOException
-    {
-        process(metadata, inputStream, null);
-    }
-
-    public static void process(@NotNull Metadata metadata, @NotNull InputStream inputStream, @Nullable Iterable<JpegSegmentMetadataReader> readers) throws JpegProcessingException, IOException
-    {
-        if (readers == null)
-            readers = ALL_READERS;
-
-        Set<JpegSegmentType> segmentTypes = new HashSet<JpegSegmentType>();
-        for (JpegSegmentMetadataReader reader : readers) {
-            for (JpegSegmentType type : reader.getSegmentTypes()) {
-                segmentTypes.add(type);
-            }
-        }
-
-        JpegSegmentData segmentData = JpegSegmentReader.readSegments(new StreamReader(inputStream), segmentTypes);
-
-        processJpegSegmentData(metadata, readers, segmentData);
-    }
-
-    public static void processJpegSegmentData(Metadata metadata, Iterable<JpegSegmentMetadataReader> readers, JpegSegmentData segmentData)
-    {
-        // Pass the appropriate byte arrays to each reader.
-        for (JpegSegmentMetadataReader reader : readers) {
-            for (JpegSegmentType segmentType : reader.getSegmentTypes()) {
-                reader.readJpegSegments(segmentData.getSegments(segmentType), metadata, segmentType);
-            }
-        }
-    }
-
-    private JpegMetadataReader() throws Exception
-    {
-        throw new Exception("Not intended for instantiation");
-    }
-}
Index: trunk/src/com/drew/imaging/jpeg/JpegProcessingException.java
===================================================================
--- trunk/src/com/drew/imaging/jpeg/JpegProcessingException.java	(revision 15218)
+++ 	(revision )
@@ -1,49 +1,0 @@
-/*
- * Copyright 2002-2019 Drew Noakes and contributors
- *
- *    Licensed under the Apache License, Version 2.0 (the "License");
- *    you may not use this file except in compliance with the License.
- *    You may obtain a copy of the License at
- *
- *        http://www.apache.org/licenses/LICENSE-2.0
- *
- *    Unless required by applicable law or agreed to in writing, software
- *    distributed under the License is distributed on an "AS IS" BASIS,
- *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *    See the License for the specific language governing permissions and
- *    limitations under the License.
- *
- * More information about this project is available at:
- *
- *    https://drewnoakes.com/code/exif/
- *    https://github.com/drewnoakes/metadata-extractor
- */
-package com.drew.imaging.jpeg;
-
-import com.drew.imaging.ImageProcessingException;
-import com.drew.lang.annotations.Nullable;
-
-/**
- * An exception class thrown upon unexpected and fatal conditions while processing a JPEG file.
- *
- * @author Drew Noakes https://drewnoakes.com
- */
-public class JpegProcessingException extends ImageProcessingException
-{
-    private static final long serialVersionUID = -7870179776125450158L;
-
-    public JpegProcessingException(@Nullable String message)
-    {
-        super(message);
-    }
-
-    public JpegProcessingException(@Nullable String message, @Nullable Throwable cause)
-    {
-        super(message, cause);
-    }
-
-    public JpegProcessingException(@Nullable Throwable cause)
-    {
-        super(cause);
-    }
-}
Index: trunk/src/com/drew/imaging/jpeg/JpegSegmentData.java
===================================================================
--- trunk/src/com/drew/imaging/jpeg/JpegSegmentData.java	(revision 15218)
+++ 	(revision )
@@ -1,270 +1,0 @@
-/*
- * Copyright 2002-2019 Drew Noakes and contributors
- *
- *    Licensed under the Apache License, Version 2.0 (the "License");
- *    you may not use this file except in compliance with the License.
- *    You may obtain a copy of the License at
- *
- *        http://www.apache.org/licenses/LICENSE-2.0
- *
- *    Unless required by applicable law or agreed to in writing, software
- *    distributed under the License is distributed on an "AS IS" BASIS,
- *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *    See the License for the specific language governing permissions and
- *    limitations under the License.
- *
- * More information about this project is available at:
- *
- *    https://drewnoakes.com/code/exif/
- *    https://github.com/drewnoakes/metadata-extractor
- */
-package com.drew.imaging.jpeg;
-
-import com.drew.lang.annotations.NotNull;
-import com.drew.lang.annotations.Nullable;
-
-import java.util.*;
-
-/**
- * Holds a collection of JPEG data segments.  This need not necessarily be all segments
- * within the JPEG. For example, it may be convenient to store only the non-image
- * segments when analysing metadata.
- * <p>
- * Segments are keyed via their {@link JpegSegmentType}. Where multiple segments use the
- * same segment type, they will all be stored and available.
- * <p>
- * Each segment type may contain multiple entries. Conceptually the model is:
- * <code>Map&lt;JpegSegmentType, Collection&lt;byte[]&gt;&gt;</code>. This class provides
- * convenience methods around that structure.
- *
- * @author Drew Noakes https://drewnoakes.com
- */
-public class JpegSegmentData
-{
-    // TODO key this on JpegSegmentType rather than Byte, and hopefully lose much of the use of 'byte' with this class
-    @NotNull
-    private final HashMap<Byte, List<byte[]>> _segmentDataMap = new HashMap<Byte, List<byte[]>>(10);
-
-    /**
-     * Adds segment bytes to the collection.
-     *
-     * @param segmentType  the type of the segment being added
-     * @param segmentBytes the byte array holding data for the segment being added
-     */
-    @SuppressWarnings({"MismatchedQueryAndUpdateOfCollection"})
-    public void addSegment(byte segmentType, @NotNull byte[] segmentBytes)
-    {
-        getOrCreateSegmentList(segmentType).add(segmentBytes);
-    }
-
-    /**
-     * Gets the set of JPEG segment type identifiers.
-     */
-    public Iterable<JpegSegmentType> getSegmentTypes()
-    {
-        Set<JpegSegmentType> segmentTypes = new HashSet<JpegSegmentType>();
-
-        for (Byte segmentTypeByte : _segmentDataMap.keySet())
-        {
-            JpegSegmentType segmentType = JpegSegmentType.fromByte(segmentTypeByte);
-            if (segmentType == null) {
-                throw new IllegalStateException("Should not have a segmentTypeByte that is not in the enum: " + Integer.toHexString(segmentTypeByte));
-            }
-            segmentTypes.add(segmentType);
-        }
-
-        return segmentTypes;
-    }
-
-    /**
-     * Gets the first JPEG segment data for the specified type.
-     *
-     * @param segmentType the JpegSegmentType for the desired segment
-     * @return a byte[] containing segment data or null if no data exists for that segment
-     */
-    @Nullable
-    public byte[] getSegment(byte segmentType)
-    {
-        return getSegment(segmentType, 0);
-    }
-
-    /**
-     * Gets the first JPEG segment data for the specified type.
-     *
-     * @param segmentType the JpegSegmentType for the desired segment
-     * @return a byte[] containing segment data or null if no data exists for that segment
-     */
-    @Nullable
-    public byte[] getSegment(@NotNull JpegSegmentType segmentType)
-    {
-        return getSegment(segmentType.byteValue, 0);
-    }
-
-    /**
-     * Gets segment data for a specific occurrence and type.  Use this method when more than one occurrence
-     * of segment data for a given type exists.
-     *
-     * @param segmentType identifies the required segment
-     * @param occurrence  the zero-based index of the occurrence
-     * @return the segment data as a byte[], or null if no segment exists for the type &amp; occurrence
-     */
-    @Nullable
-    public byte[] getSegment(@NotNull JpegSegmentType segmentType, int occurrence)
-    {
-        return getSegment(segmentType.byteValue, occurrence);
-    }
-
-    /**
-     * Gets segment data for a specific occurrence and type.  Use this method when more than one occurrence
-     * of segment data for a given type exists.
-     *
-     * @param segmentType identifies the required segment
-     * @param occurrence  the zero-based index of the occurrence
-     * @return the segment data as a byte[], or null if no segment exists for the type &amp; occurrence
-     */
-    @Nullable
-    public byte[] getSegment(byte segmentType, int occurrence)
-    {
-        final List<byte[]> segmentList = getSegmentList(segmentType);
-
-        return segmentList != null && segmentList.size() > occurrence
-                ? segmentList.get(occurrence)
-                : null;
-    }
-
-    /**
-     * Returns all instances of a given JPEG segment.  If no instances exist, an empty sequence is returned.
-     *
-     * @param segmentType a number which identifies the type of JPEG segment being queried
-     * @return zero or more byte arrays, each holding the data of a JPEG segment
-     */
-    @NotNull
-    public Iterable<byte[]> getSegments(@NotNull JpegSegmentType segmentType)
-    {
-        return getSegments(segmentType.byteValue);
-    }
-
-    /**
-     * Returns all instances of a given JPEG segment.  If no instances exist, an empty sequence is returned.
-     *
-     * @param segmentType a number which identifies the type of JPEG segment being queried
-     * @return zero or more byte arrays, each holding the data of a JPEG segment
-     */
-    @NotNull
-    public Iterable<byte[]> getSegments(byte segmentType)
-    {
-        final List<byte[]> segmentList = getSegmentList(segmentType);
-        return segmentList == null ? new ArrayList<byte[]>() : segmentList;
-    }
-
-    @Nullable
-    private List<byte[]> getSegmentList(byte segmentType)
-    {
-        return _segmentDataMap.get(segmentType);
-    }
-
-    @NotNull
-    private List<byte[]> getOrCreateSegmentList(byte segmentType)
-    {
-        List<byte[]> segmentList;
-        if (_segmentDataMap.containsKey(segmentType)) {
-            segmentList = _segmentDataMap.get(segmentType);
-        } else {
-            segmentList = new ArrayList<byte[]>();
-            _segmentDataMap.put(segmentType, segmentList);
-        }
-        return segmentList;
-    }
-
-    /**
-     * Returns the count of segment data byte arrays stored for a given segment type.
-     *
-     * @param segmentType identifies the required segment
-     * @return the segment count (zero if no segments exist).
-     */
-    public int getSegmentCount(@NotNull JpegSegmentType segmentType)
-    {
-        return getSegmentCount(segmentType.byteValue);
-    }
-
-    /**
-     * Returns the count of segment data byte arrays stored for a given segment type.
-     *
-     * @param segmentType identifies the required segment
-     * @return the segment count (zero if no segments exist).
-     */
-    public int getSegmentCount(byte segmentType)
-    {
-        final List<byte[]> segmentList = getSegmentList(segmentType);
-        return segmentList == null ? 0 : segmentList.size();
-    }
-
-    /**
-     * Removes a specified instance of a segment's data from the collection.  Use this method when more than one
-     * occurrence of segment data exists for a given type exists.
-     *
-     * @param segmentType identifies the required segment
-     * @param occurrence  the zero-based index of the segment occurrence to remove.
-     */
-    @SuppressWarnings({"MismatchedQueryAndUpdateOfCollection"})
-    public void removeSegmentOccurrence(@NotNull JpegSegmentType segmentType, int occurrence)
-    {
-        removeSegmentOccurrence(segmentType.byteValue, occurrence);
-    }
-
-    /**
-     * Removes a specified instance of a segment's data from the collection.  Use this method when more than one
-     * occurrence of segment data exists for a given type exists.
-     *
-     * @param segmentType identifies the required segment
-     * @param occurrence  the zero-based index of the segment occurrence to remove.
-     */
-    @SuppressWarnings({"MismatchedQueryAndUpdateOfCollection"})
-    public void removeSegmentOccurrence(byte segmentType, int occurrence)
-    {
-        final List<byte[]> segmentList = _segmentDataMap.get(segmentType);
-        segmentList.remove(occurrence);
-    }
-
-    /**
-     * Removes all segments from the collection having the specified type.
-     *
-     * @param segmentType identifies the required segment
-     */
-    public void removeSegment(@NotNull JpegSegmentType segmentType)
-    {
-        removeSegment(segmentType.byteValue);
-    }
-
-    /**
-     * Removes all segments from the collection having the specified type.
-     *
-     * @param segmentType identifies the required segment
-     */
-    public void removeSegment(byte segmentType)
-    {
-        _segmentDataMap.remove(segmentType);
-    }
-
-    /**
-     * Determines whether data is present for a given segment type.
-     *
-     * @param segmentType identifies the required segment
-     * @return true if data exists, otherwise false
-     */
-    public boolean containsSegment(@NotNull JpegSegmentType segmentType)
-    {
-        return containsSegment(segmentType.byteValue);
-    }
-
-    /**
-     * Determines whether data is present for a given segment type.
-     *
-     * @param segmentType identifies the required segment
-     * @return true if data exists, otherwise false
-     */
-    public boolean containsSegment(byte segmentType)
-    {
-        return _segmentDataMap.containsKey(segmentType);
-    }
-}
Index: trunk/src/com/drew/imaging/jpeg/JpegSegmentMetadataReader.java
===================================================================
--- trunk/src/com/drew/imaging/jpeg/JpegSegmentMetadataReader.java	(revision 15218)
+++ 	(revision )
@@ -1,26 +1,0 @@
-package com.drew.imaging.jpeg;
-
-import com.drew.lang.annotations.NotNull;
-import com.drew.metadata.Metadata;
-
-/**
- * Defines an object that extracts metadata from in JPEG segments.
- */
-public interface JpegSegmentMetadataReader
-{
-    /**
-     * Gets the set of JPEG segment types that this reader is interested in.
-     */
-    @NotNull
-    Iterable<JpegSegmentType> getSegmentTypes();
-
-    /**
-     * Extracts metadata from all instances of a particular JPEG segment type.
-     *
-     * @param segments A sequence of byte arrays from which the metadata should be extracted. These are in the order
-     *                 encountered in the original file.
-     * @param metadata The {@link Metadata} object into which extracted values should be merged.
-     * @param segmentType The {@link JpegSegmentType} being read.
-     */
-    void readJpegSegments(@NotNull final Iterable<byte[]> segments, @NotNull final Metadata metadata, @NotNull final JpegSegmentType segmentType);
-}
Index: trunk/src/com/drew/imaging/jpeg/JpegSegmentReader.java
===================================================================
--- trunk/src/com/drew/imaging/jpeg/JpegSegmentReader.java	(revision 15218)
+++ 	(revision )
@@ -1,169 +1,0 @@
-/*
- * Copyright 2002-2019 Drew Noakes and contributors
- *
- *    Licensed under the Apache License, Version 2.0 (the "License");
- *    you may not use this file except in compliance with the License.
- *    You may obtain a copy of the License at
- *
- *        http://www.apache.org/licenses/LICENSE-2.0
- *
- *    Unless required by applicable law or agreed to in writing, software
- *    distributed under the License is distributed on an "AS IS" BASIS,
- *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *    See the License for the specific language governing permissions and
- *    limitations under the License.
- *
- * More information about this project is available at:
- *
- *    https://drewnoakes.com/code/exif/
- *    https://github.com/drewnoakes/metadata-extractor
- */
-package com.drew.imaging.jpeg;
-
-import com.drew.lang.SequentialReader;
-import com.drew.lang.StreamReader;
-import com.drew.lang.annotations.NotNull;
-import com.drew.lang.annotations.Nullable;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.util.HashSet;
-import java.util.Set;
-
-/**
- * Performs read functions of JPEG files, returning specific file segments.
- * <p>
- * 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 {@link JpegSegmentType} enumeration. Use <code>readSegments</code> to read out the some
- * or all segments into a {@link JpegSegmentData} object, from which the raw JPEG segment byte arrays may be accessed.
- *
- * @author Drew Noakes https://drewnoakes.com
- */
-public class JpegSegmentReader
-{
-    /**
-     * The 0xFF byte that signals the start of a segment.
-     */
-    private static final byte SEGMENT_IDENTIFIER = (byte) 0xFF;
-
-    /**
-     * Private, because this segment crashes my algorithm, and searching for it doesn't work (yet).
-     */
-    private static final byte SEGMENT_SOS = (byte) 0xDA;
-
-    /**
-     * Private, because one wouldn't search for it.
-     */
-    private static final byte MARKER_EOI = (byte) 0xD9;
-
-    /**
-     * Processes the provided JPEG data, and extracts the specified JPEG segments into a {@link JpegSegmentData} object.
-     * <p>
-     * Will not return SOS (start of scan) or EOI (end of image) segments.
-     *
-     * @param file a {@link File} from which the JPEG data will be read.
-     * @param segmentTypes the set of JPEG segments types that are to be returned. If this argument is <code>null</code>
-     *                     then all found segment types are returned.
-     */
-    @NotNull
-    public static JpegSegmentData readSegments(@NotNull File file, @Nullable Iterable<JpegSegmentType> segmentTypes) throws JpegProcessingException, IOException
-    {
-        FileInputStream stream = null;
-        try {
-            stream = new FileInputStream(file);
-            return readSegments(new StreamReader(stream), segmentTypes);
-        } finally {
-            if (stream != null) {
-                stream.close();
-            }
-        }
-    }
-
-    /**
-     * Processes the provided JPEG data, and extracts the specified JPEG segments into a {@link JpegSegmentData} object.
-     * <p>
-     * Will not return SOS (start of scan) or EOI (end of image) segments.
-     *
-     * @param reader a {@link SequentialReader} from which the JPEG data will be read. It must be positioned at the
-     *               beginning of the JPEG data stream.
-     * @param segmentTypes the set of JPEG segments types that are to be returned. If this argument is <code>null</code>
-     *                     then all found segment types are returned.
-     */
-    @NotNull
-    public static JpegSegmentData readSegments(@NotNull final SequentialReader reader, @Nullable Iterable<JpegSegmentType> segmentTypes) throws JpegProcessingException, IOException
-    {
-        // Must be big-endian
-        assert (reader.isMotorolaByteOrder());
-
-        // first two bytes should be JPEG magic number
-        final int magicNumber = reader.getUInt16();
-        if (magicNumber != 0xFFD8) {
-            throw new JpegProcessingException("JPEG data is expected to begin with 0xFFD8 (ÿØ) not 0x" + Integer.toHexString(magicNumber));
-        }
-
-        Set<Byte> segmentTypeBytes = null;
-        if (segmentTypes != null) {
-            segmentTypeBytes = new HashSet<Byte>();
-            for (JpegSegmentType segmentType : segmentTypes) {
-                segmentTypeBytes.add(segmentType.byteValue);
-            }
-        }
-
-        JpegSegmentData segmentData = new JpegSegmentData();
-
-        do {
-            // Find the segment marker. Markers are zero or more 0xFF bytes, followed
-            // by a 0xFF and then a byte not equal to 0x00 or 0xFF.
-
-            byte segmentIdentifier = reader.getInt8();
-            byte segmentType = reader.getInt8();
-
-            // Read until we have a 0xFF byte followed by a byte that is not 0xFF or 0x00
-            while (segmentIdentifier != SEGMENT_IDENTIFIER || segmentType == SEGMENT_IDENTIFIER || segmentType == 0) {
-            	segmentIdentifier = segmentType;
-            	segmentType = reader.getInt8();
-            }
-
-            if (segmentType == SEGMENT_SOS) {
-                // The 'Start-Of-Scan' segment's length doesn't include the image data, instead would
-                // have to search for the two bytes: 0xFF 0xD9 (EOI).
-                // It comes last so simply return at this point
-                return segmentData;
-            }
-
-            if (segmentType == MARKER_EOI) {
-                // the 'End-Of-Image' segment -- this should never be found in this fashion
-                return segmentData;
-            }
-
-            // next 2-bytes are <segment-size>: [high-byte] [low-byte]
-            int segmentLength = reader.getUInt16();
-
-            // segment length includes size bytes, so subtract two
-            segmentLength -= 2;
-
-            if (segmentLength < 0)
-                throw new JpegProcessingException("JPEG segment size would be less than zero");
-
-            // Check whether we are interested in this segment
-            if (segmentTypeBytes == null || segmentTypeBytes.contains(segmentType)) {
-                byte[] segmentBytes = reader.getBytes(segmentLength);
-                assert (segmentLength == segmentBytes.length);
-                segmentData.addSegment(segmentType, segmentBytes);
-            } else {
-                // Skip this segment
-                if (!reader.trySkip(segmentLength)) {
-                    // If skipping failed, just return the segments we found so far
-                    return segmentData;
-                }
-            }
-
-        } while (true);
-    }
-
-    private JpegSegmentReader() throws Exception
-    {
-        throw new Exception("Not intended for instantiation.");
-    }
-}
Index: trunk/src/com/drew/imaging/jpeg/JpegSegmentType.java
===================================================================
--- trunk/src/com/drew/imaging/jpeg/JpegSegmentType.java	(revision 15218)
+++ 	(revision )
@@ -1,194 +1,0 @@
-/*
- * Copyright 2002-2019 Drew Noakes and contributors
- *
- *    Licensed under the Apache License, Version 2.0 (the "License");
- *    you may not use this file except in compliance with the License.
- *    You may obtain a copy of the License at
- *
- *        http://www.apache.org/licenses/LICENSE-2.0
- *
- *    Unless required by applicable law or agreed to in writing, software
- *    distributed under the License is distributed on an "AS IS" BASIS,
- *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *    See the License for the specific language governing permissions and
- *    limitations under the License.
- *
- * More information about this project is available at:
- *
- *    https://drewnoakes.com/code/exif/
- *    https://github.com/drewnoakes/metadata-extractor
- */
-package com.drew.imaging.jpeg;
-
-import com.drew.lang.annotations.Nullable;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-
-/**
- * An enumeration of the known segment types found in JPEG files.
- *
- * <ul>
- *     <li>http://www.ozhiker.com/electronics/pjmt/jpeg_info/app_segments.html</li>
- *     <li>http://www.sno.phy.queensu.ca/~phil/exiftool/TagNames/JPEG.html</li>
- * </ul>
- *
- * @author Drew Noakes https://drewnoakes.com
- */
-public enum JpegSegmentType
-{
-    /** APP0 JPEG segment identifier. Commonly contains JFIF, JFXX. */
-    APP0((byte)0xE0, true),
-
-    /** APP1 JPEG segment identifier. Commonly contains Exif. XMP data is also kept in here, though usually in a second instance. */
-    APP1((byte)0xE1, true),
-
-    /** APP2 JPEG segment identifier. Commonly contains ICC. */
-    APP2((byte)0xE2, true),
-
-    /** APP3 JPEG segment identifier. */
-    APP3((byte)0xE3, true),
-
-    /** APP4 JPEG segment identifier. */
-    APP4((byte)0xE4, true),
-
-    /** APP5 JPEG segment identifier. */
-    APP5((byte)0xE5, true),
-
-    /** APP6 JPEG segment identifier. */
-    APP6((byte)0xE6, true),
-
-    /** APP7 JPEG segment identifier. */
-    APP7((byte)0xE7, true),
-
-    /** APP8 JPEG segment identifier. */
-    APP8((byte)0xE8, true),
-
-    /** APP9 JPEG segment identifier. */
-    APP9((byte)0xE9, true),
-
-    /** APPA (App10) JPEG segment identifier. Can contain Unicode comments, though {@link JpegSegmentType#COM} is more commonly used for comments. */
-    APPA((byte)0xEA, true),
-
-    /** APPB (App11) JPEG segment identifier. */
-    APPB((byte)0xEB, true),
-
-    /** APPC (App12) JPEG segment identifier. */
-    APPC((byte)0xEC, true),
-
-    /** APPD (App13) JPEG segment identifier. Commonly contains IPTC, Photoshop data. */
-    APPD((byte)0xED, true),
-
-    /** APPE (App14) JPEG segment identifier. Commonly contains Adobe data. */
-    APPE((byte)0xEE, true),
-
-    /** APPF (App15) JPEG segment identifier. */
-    APPF((byte)0xEF, true),
-
-    /** Start Of Image segment identifier. */
-    SOI((byte)0xD8, false),
-
-    /** Define Quantization Table segment identifier. */
-    DQT((byte)0xDB, false),
-
-    /** Define Number of Lines segment identifier. */
-    DNL((byte)0xDC, false),
-
-    /** Define Restart Interval segment identifier. */
-    DRI((byte)0xDD, false),
-
-    /** Define Hierarchical Progression segment identifier. */
-    DHP((byte)0xDE, false),
-
-    /** EXPand reference component(s) segment identifier. */
-    EXP((byte)0xDF, false),
-
-    /** Define Huffman Table segment identifier. */
-    DHT((byte)0xC4, false),
-
-    /** Define Arithmetic Coding conditioning segment identifier. */
-    DAC((byte)0xCC, false),
-
-    /** Start-of-Frame (0) segment identifier for Baseline DCT. */
-    SOF0((byte)0xC0, true),
-
-    /** Start-of-Frame (1) segment identifier for Extended sequential DCT. */
-    SOF1((byte)0xC1, true),
-
-    /** Start-of-Frame (2) segment identifier for Progressive DCT. */
-    SOF2((byte)0xC2, true),
-
-    /** Start-of-Frame (3) segment identifier for Lossless (sequential). */
-    SOF3((byte)0xC3, true),
-
-//    /** Start-of-Frame (4) segment identifier. */
-//    SOF4((byte)0xC4, true),
-
-    /** Start-of-Frame (5) segment identifier for Differential sequential DCT. */
-    SOF5((byte)0xC5, true),
-
-    /** Start-of-Frame (6) segment identifier for Differential progressive DCT. */
-    SOF6((byte)0xC6, true),
-
-    /** Start-of-Frame (7) segment identifier for Differential lossless (sequential). */
-    SOF7((byte)0xC7, true),
-
-    /** Reserved for JPEG extensions. */
-    JPG((byte)0xC8, true),
-
-    /** Start-of-Frame (9) segment identifier for Extended sequential DCT. */
-    SOF9((byte)0xC9, true),
-
-    /** Start-of-Frame (10) segment identifier for Progressive DCT. */
-    SOF10((byte)0xCA, true),
-
-    /** Start-of-Frame (11) segment identifier for Lossless (sequential). */
-    SOF11((byte)0xCB, true),
-
-//    /** Start-of-Frame (12) segment identifier. */
-//    SOF12((byte)0xCC, true),
-
-    /** Start-of-Frame (13) segment identifier for Differential sequential DCT. */
-    SOF13((byte)0xCD, true),
-
-    /** Start-of-Frame (14) segment identifier for Differential progressive DCT. */
-    SOF14((byte)0xCE, true),
-
-    /** Start-of-Frame (15) segment identifier for Differential lossless (sequential). */
-    SOF15((byte)0xCF, true),
-
-    /** JPEG comment segment identifier for comments. */
-    COM((byte)0xFE, true);
-
-    public static final Collection<JpegSegmentType> canContainMetadataTypes;
-
-    static {
-        List<JpegSegmentType> segmentTypes = new ArrayList<JpegSegmentType>();
-        for (JpegSegmentType segmentType : JpegSegmentType.class.getEnumConstants()) {
-            if (segmentType.canContainMetadata) {
-                segmentTypes.add(segmentType);
-            }
-        }
-        canContainMetadataTypes = segmentTypes;
-    }
-
-    public final byte byteValue;
-    public final boolean canContainMetadata;
-
-    JpegSegmentType(byte byteValue, boolean canContainMetadata)
-    {
-        this.byteValue = byteValue;
-        this.canContainMetadata = canContainMetadata;
-    }
-
-    @Nullable
-    public static JpegSegmentType fromByte(byte segmentTypeByte)
-    {
-        for (JpegSegmentType segmentType : JpegSegmentType.class.getEnumConstants()) {
-            if (segmentType.byteValue == segmentTypeByte)
-                return segmentType;
-        }
-        return null;
-    }
-}
Index: trunk/src/com/drew/imaging/jpeg/package-info.java
===================================================================
--- trunk/src/com/drew/imaging/jpeg/package-info.java	(revision 15218)
+++ 	(revision )
@@ -1,4 +1,0 @@
-/**
- * Contains classes for working with JPEG files.
- */
-package com.drew.imaging.jpeg;
Index: trunk/src/com/drew/imaging/package-info.java
===================================================================
--- trunk/src/com/drew/imaging/package-info.java	(revision 15218)
+++ 	(revision )
@@ -1,5 +1,0 @@
-/**
- * Contains classes for working with image file formats and photographic conversions.
- * <!-- Put @see and @since tags down here. -->
- */
-package com.drew.imaging;
Index: trunk/src/com/drew/imaging/tiff/TiffDataFormat.java
===================================================================
--- trunk/src/com/drew/imaging/tiff/TiffDataFormat.java	(revision 15218)
+++ 	(revision )
@@ -1,107 +1,0 @@
-/*
- * Copyright 2002-2019 Drew Noakes and contributors
- *
- *    Licensed under the Apache License, Version 2.0 (the "License");
- *    you may not use this file except in compliance with the License.
- *    You may obtain a copy of the License at
- *
- *        http://www.apache.org/licenses/LICENSE-2.0
- *
- *    Unless required by applicable law or agreed to in writing, software
- *    distributed under the License is distributed on an "AS IS" BASIS,
- *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *    See the License for the specific language governing permissions and
- *    limitations under the License.
- *
- * More information about this project is available at:
- *
- *    https://drewnoakes.com/code/exif/
- *    https://github.com/drewnoakes/metadata-extractor
- */
-package com.drew.imaging.tiff;
-
-import com.drew.lang.annotations.NotNull;
-import com.drew.lang.annotations.Nullable;
-
-/**
- * An enumeration of data formats used by the TIFF specification.
- *
- * @author Drew Noakes https://drewnoakes.com
- */
-public class TiffDataFormat
-{
-    public static final int CODE_INT8_U = 1;
-    public static final int CODE_STRING = 2;
-    public static final int CODE_INT16_U = 3;
-    public static final int CODE_INT32_U = 4;
-    public static final int CODE_RATIONAL_U = 5;
-    public static final int CODE_INT8_S = 6;
-    public static final int CODE_UNDEFINED = 7;
-    public static final int CODE_INT16_S = 8;
-    public static final int CODE_INT32_S = 9;
-    public static final int CODE_RATIONAL_S = 10;
-    public static final int CODE_SINGLE = 11;
-    public static final int CODE_DOUBLE = 12;
-
-    @NotNull public static final TiffDataFormat INT8_U = new TiffDataFormat("BYTE", CODE_INT8_U, 1);
-    @NotNull public static final TiffDataFormat STRING = new TiffDataFormat("STRING", CODE_STRING, 1);
-    @NotNull public static final TiffDataFormat INT16_U = new TiffDataFormat("USHORT", CODE_INT16_U, 2);
-    @NotNull public static final TiffDataFormat INT32_U = new TiffDataFormat("ULONG", CODE_INT32_U, 4);
-    @NotNull public static final TiffDataFormat RATIONAL_U = new TiffDataFormat("URATIONAL", CODE_RATIONAL_U, 8);
-    @NotNull public static final TiffDataFormat INT8_S = new TiffDataFormat("SBYTE", CODE_INT8_S, 1);
-    @NotNull public static final TiffDataFormat UNDEFINED = new TiffDataFormat("UNDEFINED", CODE_UNDEFINED, 1);
-    @NotNull public static final TiffDataFormat INT16_S = new TiffDataFormat("SSHORT", CODE_INT16_S, 2);
-    @NotNull public static final TiffDataFormat INT32_S = new TiffDataFormat("SLONG", CODE_INT32_S, 4);
-    @NotNull public static final TiffDataFormat RATIONAL_S = new TiffDataFormat("SRATIONAL", CODE_RATIONAL_S, 8);
-    @NotNull public static final TiffDataFormat SINGLE = new TiffDataFormat("SINGLE", CODE_SINGLE, 4);
-    @NotNull public static final TiffDataFormat DOUBLE = new TiffDataFormat("DOUBLE", CODE_DOUBLE, 8);
-
-    @NotNull
-    private final String _name;
-    private final int _tiffFormatCode;
-    private final int _componentSizeBytes;
-
-    @Nullable
-    public static TiffDataFormat fromTiffFormatCode(int tiffFormatCode)
-    {
-        switch (tiffFormatCode) {
-            case 1: return INT8_U;
-            case 2: return STRING;
-            case 3: return INT16_U;
-            case 4: return INT32_U;
-            case 5: return RATIONAL_U;
-            case 6: return INT8_S;
-            case 7: return UNDEFINED;
-            case 8: return INT16_S;
-            case 9: return INT32_S;
-            case 10: return RATIONAL_S;
-            case 11: return SINGLE;
-            case 12: return DOUBLE;
-        }
-        return null;
-    }
-
-    private TiffDataFormat(@NotNull String name, int tiffFormatCode, int componentSizeBytes)
-    {
-        _name = name;
-        _tiffFormatCode = tiffFormatCode;
-        _componentSizeBytes = componentSizeBytes;
-    }
-
-    public int getComponentSizeBytes()
-    {
-        return _componentSizeBytes;
-    }
-
-    public int getTiffFormatCode()
-    {
-        return _tiffFormatCode;
-    }
-
-    @Override
-    @NotNull
-    public String toString()
-    {
-        return _name;
-    }
-}
Index: trunk/src/com/drew/imaging/tiff/TiffHandler.java
===================================================================
--- trunk/src/com/drew/imaging/tiff/TiffHandler.java	(revision 15218)
+++ 	(revision )
@@ -1,88 +1,0 @@
-/*
- * Copyright 2002-2019 Drew Noakes and contributors
- *
- *    Licensed under the Apache License, Version 2.0 (the "License");
- *    you may not use this file except in compliance with the License.
- *    You may obtain a copy of the License at
- *
- *        http://www.apache.org/licenses/LICENSE-2.0
- *
- *    Unless required by applicable law or agreed to in writing, software
- *    distributed under the License is distributed on an "AS IS" BASIS,
- *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *    See the License for the specific language governing permissions and
- *    limitations under the License.
- *
- * More information about this project is available at:
- *
- *    https://drewnoakes.com/code/exif/
- *    https://github.com/drewnoakes/metadata-extractor
- */
-package com.drew.imaging.tiff;
-
-import com.drew.lang.RandomAccessReader;
-import com.drew.lang.Rational;
-import com.drew.lang.annotations.NotNull;
-import com.drew.lang.annotations.Nullable;
-import com.drew.metadata.StringValue;
-
-import java.io.IOException;
-import java.util.Set;
-
-/**
- * Interface of an class capable of handling events raised during the reading of a TIFF file
- * via {@link TiffReader}.
- *
- * @author Drew Noakes https://drewnoakes.com
- */
-public interface TiffHandler
-{
-    /**
-     * Receives the 2-byte marker found in the TIFF header.
-     * <p>
-     * Implementations are not obligated to use this information for any purpose, though it may be useful for
-     * validation or perhaps differentiating the type of mapping to use for observed tags and IFDs.
-     *
-     * @param marker the 2-byte value found at position 2 of the TIFF header
-     */
-    void setTiffMarker(int marker) throws TiffProcessingException;
-
-    boolean tryEnterSubIfd(int tagId);
-    boolean hasFollowerIfd();
-
-    void endingIFD();
-
-    @Nullable
-    Long tryCustomProcessFormat(int tagId, int formatCode, long componentCount);
-
-    boolean customProcessTag(int tagOffset,
-                             @NotNull Set<Integer> processedIfdOffsets,
-                             int tiffHeaderOffset,
-                             @NotNull RandomAccessReader reader,
-                             int tagId,
-                             int byteCount) throws IOException;
-
-    void warn(@NotNull String message);
-    void error(@NotNull String message);
-
-    void setByteArray(int tagId, @NotNull byte[] bytes);
-    void setString(int tagId, @NotNull StringValue string);
-    void setRational(int tagId, @NotNull Rational rational);
-    void setRationalArray(int tagId, @NotNull Rational[] array);
-    void setFloat(int tagId, float float32);
-    void setFloatArray(int tagId, @NotNull float[] array);
-    void setDouble(int tagId, double double64);
-    void setDoubleArray(int tagId, @NotNull double[] array);
-    void setInt8s(int tagId, byte int8s);
-    void setInt8sArray(int tagId, @NotNull byte[] array);
-    void setInt8u(int tagId, short int8u);
-    void setInt8uArray(int tagId, @NotNull short[] array);
-    void setInt16s(int tagId, int int16s);
-    void setInt16sArray(int tagId, @NotNull short[] array);
-    void setInt16u(int tagId, int int16u);
-    void setInt16uArray(int tagId, @NotNull int[] array);
-    void setInt32s(int tagId, int int32s);
-    void setInt32sArray(int tagId, @NotNull int[] array);
-    void setInt32u(int tagId, long int32u);
-    void setInt32uArray(int tagId, @NotNull long[] array);
-}
Index: trunk/src/com/drew/imaging/tiff/TiffProcessingException.java
===================================================================
--- trunk/src/com/drew/imaging/tiff/TiffProcessingException.java	(revision 15218)
+++ 	(revision )
@@ -1,51 +1,0 @@
-/*
- * Copyright 2002-2019 Drew Noakes and contributors
- *
- *    Licensed under the Apache License, Version 2.0 (the "License");
- *    you may not use this file except in compliance with the License.
- *    You may obtain a copy of the License at
- *
- *        http://www.apache.org/licenses/LICENSE-2.0
- *
- *    Unless required by applicable law or agreed to in writing, software
- *    distributed under the License is distributed on an "AS IS" BASIS,
- *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *    See the License for the specific language governing permissions and
- *    limitations under the License.
- *
- * More information about this project is available at:
- *
- *    https://drewnoakes.com/code/exif/
- *    https://github.com/drewnoakes/metadata-extractor
- */
-
-package com.drew.imaging.tiff;
-
-import com.drew.imaging.ImageProcessingException;
-import com.drew.lang.annotations.Nullable;
-
-/**
- * An exception class thrown upon unexpected and fatal conditions while processing a TIFF file.
- *
- * @author Drew Noakes https://drewnoakes.com
- * @author Darren Salomons
- */
-public class TiffProcessingException extends ImageProcessingException
-{
-    private static final long serialVersionUID = -1658134119488001891L;
-
-    public TiffProcessingException(@Nullable String message)
-    {
-        super(message);
-    }
-
-    public TiffProcessingException(@Nullable String message, @Nullable Throwable cause)
-    {
-        super(message, cause);
-    }
-
-    public TiffProcessingException(@Nullable Throwable cause)
-    {
-        super(cause);
-    }
-}
Index: trunk/src/com/drew/imaging/tiff/TiffReader.java
===================================================================
--- trunk/src/com/drew/imaging/tiff/TiffReader.java	(revision 15218)
+++ 	(revision )
@@ -1,386 +1,0 @@
-/*
- * Copyright 2002-2019 Drew Noakes and contributors
- *
- *    Licensed under the Apache License, Version 2.0 (the "License");
- *    you may not use this file except in compliance with the License.
- *    You may obtain a copy of the License at
- *
- *        http://www.apache.org/licenses/LICENSE-2.0
- *
- *    Unless required by applicable law or agreed to in writing, software
- *    distributed under the License is distributed on an "AS IS" BASIS,
- *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *    See the License for the specific language governing permissions and
- *    limitations under the License.
- *
- * More information about this project is available at:
- *
- *    https://drewnoakes.com/code/exif/
- *    https://github.com/drewnoakes/metadata-extractor
- */
-package com.drew.imaging.tiff;
-
-import com.drew.lang.RandomAccessReader;
-import com.drew.lang.Rational;
-import com.drew.lang.annotations.NotNull;
-
-import java.io.IOException;
-import java.util.HashSet;
-import java.util.Set;
-
-/**
- * Processes TIFF-formatted data, calling into client code via that {@link TiffHandler} interface.
- *
- * @author Drew Noakes https://drewnoakes.com
- */
-public class TiffReader
-{
-    /**
-     * Processes a TIFF data sequence.
-     *
-     * @param reader the {@link RandomAccessReader} from which the data should be read
-     * @param handler the {@link TiffHandler} that will coordinate processing and accept read values
-     * @param tiffHeaderOffset the offset within <code>reader</code> at which the TIFF header starts
-     * @throws TiffProcessingException if an error occurred during the processing of TIFF data that could not be
-     *                                 ignored or recovered from
-     * @throws IOException an error occurred while accessing the required data
-     */
-    public void processTiff(@NotNull final RandomAccessReader reader,
-                            @NotNull final TiffHandler handler,
-                            final int tiffHeaderOffset) throws TiffProcessingException, IOException
-    {
-        // This must be either "MM" or "II".
-        short byteOrderIdentifier = reader.getInt16(tiffHeaderOffset);
-
-        if (byteOrderIdentifier == 0x4d4d) { // "MM"
-            reader.setMotorolaByteOrder(true);
-        } else if (byteOrderIdentifier == 0x4949) { // "II"
-            reader.setMotorolaByteOrder(false);
-        } else {
-            throw new TiffProcessingException("Unclear distinction between Motorola/Intel byte ordering: " + byteOrderIdentifier);
-        }
-
-        // Check the next two values for correctness.
-        final int tiffMarker = reader.getUInt16(2 + tiffHeaderOffset);
-        handler.setTiffMarker(tiffMarker);
-
-        int firstIfdOffset = reader.getInt32(4 + tiffHeaderOffset) + tiffHeaderOffset;
-
-        // David Ekholm sent a digital camera image that has this problem
-        // TODO getLength should be avoided as it causes RandomAccessStreamReader to read to the end of the stream
-        if (firstIfdOffset >= reader.getLength() - 1) {
-            handler.warn("First IFD offset is beyond the end of the TIFF data segment -- trying default offset");
-            // First directory normally starts immediately after the offset bytes, so try that
-            firstIfdOffset = tiffHeaderOffset + 2 + 2 + 4;
-        }
-
-        Set<Integer> processedIfdOffsets = new HashSet<Integer>();
-        processIfd(handler, reader, processedIfdOffsets, firstIfdOffset, tiffHeaderOffset);
-    }
-
-    /**
-     * Processes a TIFF IFD.
-     *
-     * IFD Header:
-     * <ul>
-     *     <li><b>2 bytes</b> number of tags</li>
-     * </ul>
-     * Tag structure:
-     * <ul>
-     *     <li><b>2 bytes</b> tag type</li>
-     *     <li><b>2 bytes</b> format code (values 1 to 12, inclusive)</li>
-     *     <li><b>4 bytes</b> component count</li>
-     *     <li><b>4 bytes</b> inline value, or offset pointer if too large to fit in four bytes</li>
-     * </ul>
-     *
-     *
-     * @param handler the {@link com.drew.imaging.tiff.TiffHandler} that will coordinate processing and accept read values
-     * @param reader the {@link com.drew.lang.RandomAccessReader} from which the data should be read
-     * @param processedIfdOffsets the set of visited IFD offsets, to avoid revisiting the same IFD in an endless loop
-     * @param ifdOffset the offset within <code>reader</code> at which the IFD data starts
-     * @param tiffHeaderOffset the offset within <code>reader</code> at which the TIFF header starts
-     * @throws IOException an error occurred while accessing the required data
-     */
-    public static void processIfd(@NotNull final TiffHandler handler,
-                                  @NotNull final RandomAccessReader reader,
-                                  @NotNull final Set<Integer> processedIfdOffsets,
-                                  final int ifdOffset,
-                                  final int tiffHeaderOffset) throws IOException
-    {
-        Boolean resetByteOrder = null;
-        try {
-            // check for directories we've already visited to avoid stack overflows when recursive/cyclic directory structures exist
-            if (processedIfdOffsets.contains(Integer.valueOf(ifdOffset))) {
-                return;
-            }
-
-            // remember that we've visited this directory so that we don't visit it again later
-            processedIfdOffsets.add(ifdOffset);
-
-            if (ifdOffset >= reader.getLength() || ifdOffset < 0) {
-                handler.error("Ignored IFD marked to start outside data segment");
-                return;
-            }
-
-            // First two bytes in the IFD are the number of tags in this directory
-            int dirTagCount = reader.getUInt16(ifdOffset);
-
-            // Some software modifies the byte order of the file, but misses some IFDs (such as makernotes).
-            // The entire test image repository doesn't contain a single IFD with more than 255 entries.
-            // Here we detect switched bytes that suggest this problem, and temporarily swap the byte order.
-            // This was discussed in GitHub issue #136.
-            if (dirTagCount > 0xFF && (dirTagCount & 0xFF) == 0) {
-                resetByteOrder = reader.isMotorolaByteOrder();
-                dirTagCount >>= 8;
-                reader.setMotorolaByteOrder(!reader.isMotorolaByteOrder());
-            }
-
-            int dirLength = (2 + (12 * dirTagCount) + 4);
-            if (dirLength + ifdOffset > reader.getLength()) {
-                handler.error("Illegally sized IFD");
-                return;
-            }
-
-            //
-            // Handle each tag in this directory
-            //
-            int invalidTiffFormatCodeCount = 0;
-            for (int tagNumber = 0; tagNumber < dirTagCount; tagNumber++) {
-                final int tagOffset = calculateTagOffset(ifdOffset, tagNumber);
-
-                // 2 bytes for the tag id
-                final int tagId = reader.getUInt16(tagOffset);
-
-                // 2 bytes for the format code
-                final int formatCode = reader.getUInt16(tagOffset + 2);
-                final TiffDataFormat format = TiffDataFormat.fromTiffFormatCode(formatCode);
-
-                // 4 bytes dictate the number of components in this tag's data
-                final long componentCount = reader.getUInt32(tagOffset + 4);
-
-                final long byteCount;
-                if (format == null) {
-                    Long byteCountOverride = handler.tryCustomProcessFormat(tagId, formatCode, componentCount);
-                    if (byteCountOverride == null) {
-                        // This error suggests that we are processing at an incorrect index and will generate
-                        // rubbish until we go out of bounds (which may be a while).  Exit now.
-                        handler.error(String.format("Invalid TIFF tag format code %d for tag 0x%04X", formatCode, tagId));
-                        // TODO specify threshold as a parameter, or provide some other external control over this behaviour
-                        if (++invalidTiffFormatCodeCount > 5) {
-                            handler.error("Stopping processing as too many errors seen in TIFF IFD");
-                            return;
-                        }
-                        continue;
-                    }
-                    byteCount = byteCountOverride;
-                } else {
-                    byteCount = componentCount * format.getComponentSizeBytes();
-                }
-
-                final long tagValueOffset;
-                if (byteCount > 4) {
-                    // If it's bigger than 4 bytes, the dir entry contains an offset.
-                    final long offsetVal = reader.getUInt32(tagOffset + 8);
-                    if (offsetVal + byteCount > reader.getLength()) {
-                        // Bogus pointer offset and / or byteCount value
-                        handler.error("Illegal TIFF tag pointer offset");
-                        continue;
-                    }
-                    tagValueOffset = tiffHeaderOffset + offsetVal;
-                } else {
-                    // 4 bytes or less and value is in the dir entry itself.
-                    tagValueOffset = tagOffset + 8;
-                }
-
-                if (tagValueOffset < 0 || tagValueOffset > reader.getLength()) {
-                    handler.error("Illegal TIFF tag pointer offset");
-                    continue;
-                }
-
-                // Check that this tag isn't going to allocate outside the bounds of the data array.
-                // This addresses an uncommon OutOfMemoryError.
-                if (byteCount < 0 || tagValueOffset + byteCount > reader.getLength()) {
-                    handler.error("Illegal number of bytes for TIFF tag data: " + byteCount);
-                    continue;
-                }
-
-                // Some tags point to one or more additional IFDs to process
-                boolean isIfdPointer = false;
-                if (byteCount == 4 * componentCount) {
-                    for (int i = 0; i < componentCount; i++) {
-                        if (handler.tryEnterSubIfd(tagId)) {
-                            isIfdPointer = true;
-                            int subDirOffset = tiffHeaderOffset + reader.getInt32((int) (tagValueOffset + i * 4));
-                            processIfd(handler, reader, processedIfdOffsets, subDirOffset, tiffHeaderOffset);
-                        }
-                    }
-                }
-
-                // If it wasn't an IFD pointer, allow custom tag processing to occur
-                if (!isIfdPointer && !handler.customProcessTag((int) tagValueOffset, processedIfdOffsets, tiffHeaderOffset, reader, tagId, (int) byteCount)) {
-                    // If no custom processing occurred, process the tag in the standard fashion
-                    processTag(handler, tagId, (int) tagValueOffset, (int) componentCount, formatCode, reader);
-                }
-            }
-
-            // at the end of each IFD is an optional link to the next IFD
-            final int finalTagOffset = calculateTagOffset(ifdOffset, dirTagCount);
-            int nextIfdOffset = reader.getInt32(finalTagOffset);
-            if (nextIfdOffset != 0) {
-                nextIfdOffset += tiffHeaderOffset;
-                if (nextIfdOffset >= reader.getLength()) {
-                    // Last 4 bytes of IFD reference another IFD with an address that is out of bounds
-                    // Note this could have been caused by jhead 1.3 cropping too much
-                    return;
-                } else if (nextIfdOffset < ifdOffset) {
-                    // TODO is this a valid restriction?
-                    // Last 4 bytes of IFD reference another IFD with an address that is before the start of this directory
-                    return;
-                }
-
-                if (handler.hasFollowerIfd()) {
-                    processIfd(handler, reader, processedIfdOffsets, nextIfdOffset, tiffHeaderOffset);
-                }
-            }
-        } finally {
-            handler.endingIFD();
-            if (resetByteOrder != null)
-                reader.setMotorolaByteOrder(resetByteOrder);
-        }
-    }
-
-    private static void processTag(@NotNull final TiffHandler handler,
-                                   final int tagId,
-                                   final int tagValueOffset,
-                                   final int componentCount,
-                                   final int formatCode,
-                                   @NotNull final RandomAccessReader reader) throws IOException
-    {
-        switch (formatCode) {
-            case TiffDataFormat.CODE_UNDEFINED:
-                // this includes exif user comments
-                handler.setByteArray(tagId, reader.getBytes(tagValueOffset, componentCount));
-                break;
-            case TiffDataFormat.CODE_STRING:
-                handler.setString(tagId, reader.getNullTerminatedStringValue(tagValueOffset, componentCount, null));
-                break;
-            case TiffDataFormat.CODE_RATIONAL_S:
-                if (componentCount == 1) {
-                    handler.setRational(tagId, new Rational(reader.getInt32(tagValueOffset), reader.getInt32(tagValueOffset + 4)));
-                } else if (componentCount > 1) {
-                    Rational[] array = new Rational[componentCount];
-                    for (int i = 0; i < componentCount; i++)
-                        array[i] = new Rational(reader.getInt32(tagValueOffset + (8 * i)), reader.getInt32(tagValueOffset + 4 + (8 * i)));
-                    handler.setRationalArray(tagId, array);
-                }
-                break;
-            case TiffDataFormat.CODE_RATIONAL_U:
-                if (componentCount == 1) {
-                    handler.setRational(tagId, new Rational(reader.getUInt32(tagValueOffset), reader.getUInt32(tagValueOffset + 4)));
-                } else if (componentCount > 1) {
-                    Rational[] array = new Rational[componentCount];
-                    for (int i = 0; i < componentCount; i++)
-                        array[i] = new Rational(reader.getUInt32(tagValueOffset + (8 * i)), reader.getUInt32(tagValueOffset + 4 + (8 * i)));
-                    handler.setRationalArray(tagId, array);
-                }
-                break;
-            case TiffDataFormat.CODE_SINGLE:
-                if (componentCount == 1) {
-                    handler.setFloat(tagId, reader.getFloat32(tagValueOffset));
-                } else {
-                    float[] array = new float[componentCount];
-                    for (int i = 0; i < componentCount; i++)
-                        array[i] = reader.getFloat32(tagValueOffset + (i * 4));
-                    handler.setFloatArray(tagId, array);
-                }
-                break;
-            case TiffDataFormat.CODE_DOUBLE:
-                if (componentCount == 1) {
-                    handler.setDouble(tagId, reader.getDouble64(tagValueOffset));
-                } else {
-                    double[] array = new double[componentCount];
-                    for (int i = 0; i < componentCount; i++)
-                        array[i] = reader.getDouble64(tagValueOffset + (i * 4));
-                    handler.setDoubleArray(tagId, array);
-                }
-                break;
-            case TiffDataFormat.CODE_INT8_S:
-                if (componentCount == 1) {
-                    handler.setInt8s(tagId, reader.getInt8(tagValueOffset));
-                } else {
-                    byte[] array = new byte[componentCount];
-                    for (int i = 0; i < componentCount; i++)
-                        array[i] = reader.getInt8(tagValueOffset + i);
-                    handler.setInt8sArray(tagId, array);
-                }
-                break;
-            case TiffDataFormat.CODE_INT8_U:
-                if (componentCount == 1) {
-                    handler.setInt8u(tagId, reader.getUInt8(tagValueOffset));
-                } else {
-                    short[] array = new short[componentCount];
-                    for (int i = 0; i < componentCount; i++)
-                        array[i] = reader.getUInt8(tagValueOffset + i);
-                    handler.setInt8uArray(tagId, array);
-                }
-                break;
-            case TiffDataFormat.CODE_INT16_S:
-                if (componentCount == 1) {
-                    handler.setInt16s(tagId, (int)reader.getInt16(tagValueOffset));
-                } else {
-                    short[] array = new short[componentCount];
-                    for (int i = 0; i < componentCount; i++)
-                        array[i] = reader.getInt16(tagValueOffset + (i * 2));
-                    handler.setInt16sArray(tagId, array);
-                }
-                break;
-            case TiffDataFormat.CODE_INT16_U:
-                if (componentCount == 1) {
-                    handler.setInt16u(tagId, reader.getUInt16(tagValueOffset));
-                } else {
-                    int[] array = new int[componentCount];
-                    for (int i = 0; i < componentCount; i++)
-                        array[i] = reader.getUInt16(tagValueOffset + (i * 2));
-                    handler.setInt16uArray(tagId, array);
-                }
-                break;
-            case TiffDataFormat.CODE_INT32_S:
-                // NOTE 'long' in this case means 32 bit, not 64
-                if (componentCount == 1) {
-                    handler.setInt32s(tagId, reader.getInt32(tagValueOffset));
-                } else {
-                    int[] array = new int[componentCount];
-                    for (int i = 0; i < componentCount; i++)
-                        array[i] = reader.getInt32(tagValueOffset + (i * 4));
-                    handler.setInt32sArray(tagId, array);
-                }
-                break;
-            case TiffDataFormat.CODE_INT32_U:
-                // NOTE 'long' in this case means 32 bit, not 64
-                if (componentCount == 1) {
-                    handler.setInt32u(tagId, reader.getUInt32(tagValueOffset));
-                } else {
-                    long[] array = new long[componentCount];
-                    for (int i = 0; i < componentCount; i++)
-                        array[i] = reader.getUInt32(tagValueOffset + (i * 4));
-                    handler.setInt32uArray(tagId, array);
-                }
-                break;
-            default:
-                handler.error(String.format("Invalid TIFF tag format code %d for tag 0x%04X", formatCode, tagId));
-        }
-    }
-
-    /**
-     * Determine the offset of a given tag within the specified IFD.
-     *
-     * @param ifdStartOffset the offset at which the IFD starts
-     * @param entryNumber    the zero-based entry number
-     */
-    private static int calculateTagOffset(int ifdStartOffset, int entryNumber)
-    {
-        // Add 2 bytes for the tag count.
-        // Each entry is 12 bytes.
-        return ifdStartOffset + 2 + (12 * entryNumber);
-    }
-}
Index: trunk/src/com/drew/imaging/tiff/package-info.java
===================================================================
--- trunk/src/com/drew/imaging/tiff/package-info.java	(revision 15218)
+++ 	(revision )
@@ -1,4 +1,0 @@
-/**
- * Contains classes for working with TIFF format files.
- */
-package com.drew.imaging.tiff;
