Package org.apache.commons.imaging.formats.jpeg.xmp

## Class JpegRewriter

- java.lang.Object
- - org.apache.commons.imaging.common.BinaryFileParser
  - - org.apache.commons.imaging.formats.jpeg.xmp.JpegRewriter

- Direct Known Subclasses:
    `JpegIptcRewriter`, `JpegXmpRewriter`

      public class JpegRewriter
      extends BinaryFileParser

  Interface for Exif write/update/remove functionality for Jpeg/JFIF images.

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class | Description
    --- | --- | ---
    `protected static class` | `JpegRewriter.JFIFPiece` |
    `protected static class` | `JpegRewriter.JFIFPieces` |
    `protected static class` | `JpegRewriter.JFIFPieceSegment` |
    `static class` | `JpegRewriter.JpegSegmentOverflowException` |

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `JpegRewriter()` | Constructor.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `protected JpegRewriter.JFIFPieces` | `analyzeJFIF​(ByteSource byteSource)` |
    `protected <T extends JpegRewriter.JFIFPiece> List<T>` | `filterSegments​(List<T> segments, org.apache.commons.imaging.formats.jpeg.xmp.JpegRewriter.SegmentFilter filter)` |
    `protected <T extends JpegRewriter.JFIFPiece> List<T>` | `filterSegments​(List<T> segments, org.apache.commons.imaging.formats.jpeg.xmp.JpegRewriter.SegmentFilter filter, boolean reverse)` |
    `protected <T extends JpegRewriter.JFIFPiece> List<T>` | `findPhotoshopApp13Segments​(List<T> segments)` |
    `protected <T extends JpegRewriter.JFIFPiece,​U extends JpegRewriter.JFIFPiece> List<JpegRewriter.JFIFPiece>` | `insertAfterLastAppSegments​(List<T> segments, List<U> newSegments)` |
    `protected <T extends JpegRewriter.JFIFPiece,​U extends JpegRewriter.JFIFPiece> List<JpegRewriter.JFIFPiece>` | `insertBeforeFirstAppSegments​(List<T> segments, List<U> newSegments)` |
    `protected <T extends JpegRewriter.JFIFPiece> List<T>` | `removeExifSegments​(List<T> segments)` |
    `protected <T extends JpegRewriter.JFIFPiece> List<T>` | `removePhotoshopApp13Segments​(List<T> segments)` |
    `protected <T extends JpegRewriter.JFIFPiece> List<T>` | `removeXmpSegments​(List<T> segments)` |
    `protected void` | `writeSegments​(OutputStream outputStream, List<? extends JpegRewriter.JFIFPiece> segments)` |

    - ### Methods inherited from class org.apache.commons.imaging.common.BinaryFileParser

      `debugNumber, debugNumber, getByteOrder, setByteOrder`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### JpegRewriter

          public JpegRewriter()

      Constructor. to guess whether a file contains an image based on its file extension.

  - ### Method Detail

    - #### analyzeJFIF

          protected JpegRewriter.JFIFPieces analyzeJFIF​(ByteSource byteSource)
                                                 throws ImageReadException,
                                                        IOException

      Throws:
        `ImageReadException`
        `IOException`

    - #### removeXmpSegments

          protected <T extends JpegRewriter.JFIFPiece> List<T> removeXmpSegments​(List<T> segments)

    - #### removePhotoshopApp13Segments

          protected <T extends JpegRewriter.JFIFPiece> List<T> removePhotoshopApp13Segments​(List<T> segments)

    - #### findPhotoshopApp13Segments

          protected <T extends JpegRewriter.JFIFPiece> List<T> findPhotoshopApp13Segments​(List<T> segments)

    - #### removeExifSegments

          protected <T extends JpegRewriter.JFIFPiece> List<T> removeExifSegments​(List<T> segments)

    - #### filterSegments

          protected <T extends JpegRewriter.JFIFPiece> List<T> filterSegments​(List<T> segments,
                                                                              org.apache.commons.imaging.formats.jpeg.xmp.JpegRewriter.SegmentFilter filter)

    - #### filterSegments

          protected <T extends JpegRewriter.JFIFPiece> List<T> filterSegments​(List<T> segments,
                                                                              org.apache.commons.imaging.formats.jpeg.xmp.JpegRewriter.SegmentFilter filter,
                                                                              boolean reverse)

    - #### insertBeforeFirstAppSegments

          protected <T extends JpegRewriter.JFIFPiece,​U extends JpegRewriter.JFIFPiece> List<JpegRewriter.JFIFPiece> insertBeforeFirstAppSegments​(List<T> segments,
                                                                                                                                                        List<U> newSegments)
                                                                                                                                                 throws ImageWriteException

      Throws:
        `ImageWriteException`

    - #### insertAfterLastAppSegments

          protected <T extends JpegRewriter.JFIFPiece,​U extends JpegRewriter.JFIFPiece> List<JpegRewriter.JFIFPiece> insertAfterLastAppSegments​(List<T> segments,
                                                                                                                                                      List<U> newSegments)
                                                                                                                                               throws ImageWriteException

      Throws:
        `ImageWriteException`

    - #### writeSegments

          protected void writeSegments​(OutputStream outputStream,
                                       List<? extends JpegRewriter.JFIFPiece> segments)
                                throws IOException

      Throws:
        `IOException`