public class EXIFUtilities extends Object
Modifier and Type | Class and Description |
---|---|
static class |
EXIFUtilities.EXIFTagType
Deprecated.
use
EXIFTags#Type |
Modifier and Type | Field and Description |
---|---|
static int |
TAG_COPYRIGHT
Deprecated.
|
static int |
TAG_EXIF_IFD_POINTER
Deprecated.
|
static int |
TAG_USER_COMMENT
Deprecated.
|
Constructor and Description |
---|
EXIFUtilities() |
Modifier and Type | Method and Description |
---|---|
static int |
bytes2ToInt(byte[] buff,
int start,
boolean isBigEndian)
Simple utility methods returning an int built on top of 2 bytes, in compliance
with the specified endianness
|
static int |
bytes4ToInt(byte[] buff,
int start,
boolean isBigEndian)
Simple utility methods returning an int built on top of 4 bytes, in compliance
with the specified endianness
|
static TIFFTagWrapper |
createTag(int tagNumber) |
static void |
insertEXIFintoStream(OutputStream outputStream,
byte[] imageData,
int imageDataSize,
EXIFMetadata exif)
This method allows to parse the provided
EXIFMetadata object and put it into
the specified outputStream while copying back the JPEG encoded image referred by
the imageData argument. |
static byte[] |
intToBytes(int value)
Simple utility method returning a 2 bytes representation of a value as bigEndian
|
static byte[] |
intToBytes(int value,
boolean isBigEndian)
Simple utility method returning a 2 bytes representation of a value, in compliance with the
specified endianness
|
static int |
locateFirst(byte[] buffer,
byte[] candidate)
Scan the input byte buffer, looking for a candidate bytes sequence and return
the index of the first occurrence within the input buffer, or -1 in case nothing
is found.
|
static void |
replaceEXIFs(FileImageInputStreamExt inputStream,
EXIFMetadata exif)
Replace the EXIF contained within a file referred by a
FileImageInputStreamExt instance
with the EXIF represented by the specified EXIFMetadata instance. |
public static final int TAG_COPYRIGHT
EXIFTags.COPYRIGHT
public static final int TAG_EXIF_IFD_POINTER
EXIFTags.EXIF_IFD_POINTER
public static final int TAG_USER_COMMENT
EXIFTags.USER_COMMENT
public static void insertEXIFintoStream(OutputStream outputStream, byte[] imageData, int imageDataSize, EXIFMetadata exif) throws IOException
EXIFMetadata
object and put it into
the specified outputStream while copying back the JPEG encoded image referred by
the imageData argument.outputStream
- the stream where to writeimageData
- the bytes containing JPEG encoded image dataimageDataSize
- the number of bytes to be used from the data arrayexif
- the EXIFMetadata
object holding EXIF.IOException
public static final byte[] intToBytes(int value, boolean isBigEndian)
value
- the value to be represented through 2 bytesisBigEndian
- true
in case of bigEndianpublic static final byte[] intToBytes(int value)
value
- the value to be represented through 2 bytespublic static final int bytes2ToInt(byte[] buff, int start, boolean isBigEndian)
buff
- the buffer containing 2 bytes to be transformedstart
- the position within the buffer of the first byte to be transformedisBigEndian
- true
in case we need to encode it as bigEndianpublic static final int bytes4ToInt(byte[] buff, int start, boolean isBigEndian)
buff
- the buffer containing 4 bytes to be transformedstart
- the position within the buffer of the first byte to be transformedisBigEndian
- true
in case we need to encode it as bigEndianpublic static int locateFirst(byte[] buffer, byte[] candidate)
public static void replaceEXIFs(FileImageInputStreamExt inputStream, EXIFMetadata exif) throws IOException
FileImageInputStreamExt
instance
with the EXIF represented by the specified EXIFMetadata
instance. The original file
will be overwritten by the new one containing updated EXIF.
It is worth to point out that this replacing method won't currently perform any fields delete,
but simply content update. Therefore, tags in the original EXIF which are missing in the
updated EXIF parameter, won't be modified.inputStream
- a FileImageInputStreamExt
referring to a JPEG containing EXIFexif
- the EXIFMetadata
instance containing tags to be updatedIOException
public static TIFFTagWrapper createTag(int tagNumber)
tagNumber
- Copyright © 2006–2014 GeoSolutions. All rights reserved.