Class JpegXmpRewriter
- java.lang.Object
-
- org.apache.commons.imaging.common.BinaryFileParser
-
- org.apache.commons.imaging.formats.jpeg.xmp.JpegRewriter
-
- org.apache.commons.imaging.formats.jpeg.xmp.JpegXmpRewriter
-
public class JpegXmpRewriter extends JpegRewriter
Interface for Exif write/update/remove functionality for Jpeg/JFIF images.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.apache.commons.imaging.formats.jpeg.xmp.JpegRewriter
JpegRewriter.JFIFPiece, JpegRewriter.JFIFPieceImageData, JpegRewriter.JFIFPieces, JpegRewriter.JFIFPieceSegment, JpegRewriter.JpegSegmentOverflowException
-
-
Constructor Summary
Constructors Constructor Description JpegXmpRewriter()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
removeXmpXml(byte[] src, java.io.OutputStream os)
Reads a Jpeg image, removes all XMP XML (by removing the APP1 segment), and writes the result to a stream.void
removeXmpXml(java.io.File src, java.io.OutputStream os)
Reads a Jpeg image, removes all XMP XML (by removing the APP1 segment), and writes the result to a stream.void
removeXmpXml(java.io.InputStream src, java.io.OutputStream os)
Reads a Jpeg image, removes all XMP XML (by removing the APP1 segment), and writes the result to a stream.void
removeXmpXml(ByteSource byteSource, java.io.OutputStream os)
Reads a Jpeg image, removes all XMP XML (by removing the APP1 segment), and writes the result to a stream.void
updateXmpXml(byte[] src, java.io.OutputStream os, java.lang.String xmpXml)
Reads a Jpeg image, replaces the XMP XML and writes the result to a stream.void
updateXmpXml(java.io.File src, java.io.OutputStream os, java.lang.String xmpXml)
Reads a Jpeg image, replaces the XMP XML and writes the result to a stream.void
updateXmpXml(java.io.InputStream src, java.io.OutputStream os, java.lang.String xmpXml)
Reads a Jpeg image, replaces the XMP XML and writes the result to a stream.void
updateXmpXml(ByteSource byteSource, java.io.OutputStream os, java.lang.String xmpXml)
Reads a Jpeg image, replaces the XMP XML and writes the result to a stream.private byte[]
writeXmpSegment(byte[] xmpXmlData, int start, int length)
-
Methods inherited from class org.apache.commons.imaging.formats.jpeg.xmp.JpegRewriter
analyzeJFIF, filterSegments, filterSegments, findPhotoshopApp13Segments, insertAfterLastAppSegments, insertBeforeFirstAppSegments, removeExifSegments, removePhotoshopApp13Segments, removeXmpSegments, writeSegments
-
Methods inherited from class org.apache.commons.imaging.common.BinaryFileParser
debugNumber, debugNumber, getByteOrder, setByteOrder
-
-
-
-
Method Detail
-
removeXmpXml
public void removeXmpXml(java.io.File src, java.io.OutputStream os) throws ImageReadException, java.io.IOException
Reads a Jpeg image, removes all XMP XML (by removing the APP1 segment), and writes the result to a stream.- Parameters:
src
- Image file.os
- OutputStream to write the image to.- Throws:
ImageReadException
- if it fails to read the JFIF segmentsjava.io.IOException
- if it fails to read or write the data from the segments- See Also:
File
,OutputStream
-
removeXmpXml
public void removeXmpXml(byte[] src, java.io.OutputStream os) throws ImageReadException, java.io.IOException
Reads a Jpeg image, removes all XMP XML (by removing the APP1 segment), and writes the result to a stream.- Parameters:
src
- Byte array containing Jpeg image data.os
- OutputStream to write the image to.- Throws:
ImageReadException
- if it fails to read the JFIF segmentsjava.io.IOException
- if it fails to read or write the data from the segments
-
removeXmpXml
public void removeXmpXml(java.io.InputStream src, java.io.OutputStream os) throws ImageReadException, java.io.IOException
Reads a Jpeg image, removes all XMP XML (by removing the APP1 segment), and writes the result to a stream.- Parameters:
src
- InputStream containing Jpeg image data.os
- OutputStream to write the image to.- Throws:
ImageReadException
- if it fails to read the JFIF segmentsjava.io.IOException
- if it fails to read or write the data from the segments
-
removeXmpXml
public void removeXmpXml(ByteSource byteSource, java.io.OutputStream os) throws ImageReadException, java.io.IOException
Reads a Jpeg image, removes all XMP XML (by removing the APP1 segment), and writes the result to a stream.- Parameters:
byteSource
- ByteSource containing Jpeg image data.os
- OutputStream to write the image to.- Throws:
ImageReadException
- if it fails to read the JFIF segmentsjava.io.IOException
- if it fails to read or write the data from the segments
-
updateXmpXml
public void updateXmpXml(byte[] src, java.io.OutputStream os, java.lang.String xmpXml) throws ImageReadException, java.io.IOException, ImageWriteException
Reads a Jpeg image, replaces the XMP XML and writes the result to a stream.- Parameters:
src
- Byte array containing Jpeg image data.os
- OutputStream to write the image to.xmpXml
- String containing XMP XML.- Throws:
ImageReadException
- if it fails to read the JFIF segmentsjava.io.IOException
- if it fails to read or write the data from the segmentsImageWriteException
- if it fails to write the JFIF segments
-
updateXmpXml
public void updateXmpXml(java.io.InputStream src, java.io.OutputStream os, java.lang.String xmpXml) throws ImageReadException, java.io.IOException, ImageWriteException
Reads a Jpeg image, replaces the XMP XML and writes the result to a stream.- Parameters:
src
- InputStream containing Jpeg image data.os
- OutputStream to write the image to.xmpXml
- String containing XMP XML.- Throws:
ImageReadException
- if it fails to read the JFIF segmentsjava.io.IOException
- if it fails to read or write the data from the segmentsImageWriteException
- if it fails to write the JFIF segments
-
updateXmpXml
public void updateXmpXml(java.io.File src, java.io.OutputStream os, java.lang.String xmpXml) throws ImageReadException, java.io.IOException, ImageWriteException
Reads a Jpeg image, replaces the XMP XML and writes the result to a stream.- Parameters:
src
- Image file.os
- OutputStream to write the image to.xmpXml
- String containing XMP XML.- Throws:
ImageReadException
- if it fails to read the JFIF segmentsjava.io.IOException
- if it fails to read or write the data from the segmentsImageWriteException
- if it fails to write the JFIF segments
-
updateXmpXml
public void updateXmpXml(ByteSource byteSource, java.io.OutputStream os, java.lang.String xmpXml) throws ImageReadException, java.io.IOException, ImageWriteException
Reads a Jpeg image, replaces the XMP XML and writes the result to a stream.- Parameters:
byteSource
- ByteSource containing Jpeg image data.os
- OutputStream to write the image to.xmpXml
- String containing XMP XML.- Throws:
ImageReadException
- if it fails to read the JFIF segmentsjava.io.IOException
- if it fails to read or write the data from the segmentsImageWriteException
- if it fails to write the JFIF segments
-
writeXmpSegment
private byte[] writeXmpSegment(byte[] xmpXmlData, int start, int length) throws java.io.IOException
- Throws:
java.io.IOException
-
-