public AdobeJpegDirectory Extract([NotNull] SequentialReader reader)
        {
            reader = reader.WithByteOrder(isMotorolaByteOrder: false);

            var directory = new AdobeJpegDirectory();

            try
            {
                if (reader.GetString(JpegSegmentPreamble.Length, Encoding.UTF8) != JpegSegmentPreamble)
                {
                    directory.AddError("Invalid Adobe JPEG data header.");
                    return(directory);
                }

                directory.Set(AdobeJpegDirectory.TagDctEncodeVersion, reader.GetUInt16());
                directory.Set(AdobeJpegDirectory.TagApp14Flags0, reader.GetUInt16());
                directory.Set(AdobeJpegDirectory.TagApp14Flags1, reader.GetUInt16());
                directory.Set(AdobeJpegDirectory.TagColorTransform, reader.GetSByte());
            }
            catch (IOException ex)
            {
                directory.AddError("IO exception processing data: " + ex.Message);
            }

            return(directory);
        }
        public AdobeJpegDirectory Extract(SequentialReader reader)
        {
            reader.IsMotorolaByteOrder = false;

            var directory = new AdobeJpegDirectory();

            try
            {
                if (reader.GetString(Preamble.Length) != Preamble)
                {
                    directory.AddError("Invalid Adobe JPEG data header.");
                    return directory;
                }

                directory.Set(AdobeJpegDirectory.TagDctEncodeVersion, reader.GetUInt16());
                directory.Set(AdobeJpegDirectory.TagApp14Flags0, reader.GetUInt16());
                directory.Set(AdobeJpegDirectory.TagApp14Flags1, reader.GetUInt16());
                directory.Set(AdobeJpegDirectory.TagColorTransform, reader.GetSByte());
            }
            catch (IOException ex)
            {
                directory.AddError("IO exception processing data: " + ex.Message);
            }

            return directory;
        }