public class ImageMetadataReader extends Object
This class a lightweight wrapper around other, specific metadata processors. During extraction, the file type is determined from the first few bytes of the file. Parsing is then delegated to one of:
AviMetadataReader
for AVI filesBmpMetadataReader
for BMP filesFileSystemMetadataReader
for metadata from the file system when a File
is providedGifMetadataReader
for GIF filesIcoMetadataReader
for ICO filesJpegMetadataReader
for JPEG filesMp4MetadataReader
for MPEG-4 filesPcxMetadataReader
for PCX filesPngMetadataReader
for PNG filesPsdMetadataReader
for Photoshop filesQuickTimeMetadataReader
for QuickTime filesRafMetadataReader
for RAF filesTiffMetadataReader
for TIFF and (most) RAW filesWavMetadataReader
for WAV filesWebpMetadataReader
for WebP files
FileTypeDetector
is used to determine the provided image's file type, and therefore
the appropriate metadata reader to use.
Modifier and Type | Method and Description |
---|---|
static void |
main(String[] args)
An application entry point.
|
static Metadata |
readMetadata(File file)
|
static Metadata |
readMetadata(InputStream inputStream)
Reads metadata from an
InputStream . |
static Metadata |
readMetadata(InputStream inputStream,
long streamLength)
Reads metadata from an
InputStream of known length. |
static Metadata |
readMetadata(InputStream inputStream,
long streamLength,
FileType fileType)
Reads metadata from an
InputStream of known length and file type. |
public static Metadata readMetadata(InputStream inputStream) throws ImageProcessingException, IOException
InputStream
.inputStream
- a stream from which the file data may be read. The stream must be positioned at the
beginning of the file's data.Metadata
object containing directories of tags with values and any processing errors.ImageProcessingException
- if the file type is unknown, or for general processing errors.IOException
public static Metadata readMetadata(InputStream inputStream, long streamLength) throws ImageProcessingException, IOException
InputStream
of known length.inputStream
- a stream from which the file data may be read. The stream must be positioned at the
beginning of the file's data.streamLength
- the length of the stream, if known, otherwise -1.Metadata
object containing directories of tags with values and any processing errors.ImageProcessingException
- if the file type is unknown, or for general processing errors.IOException
public static Metadata readMetadata(InputStream inputStream, long streamLength, FileType fileType) throws IOException, ImageProcessingException
InputStream
of known length and file type.inputStream
- a stream from which the file data may be read. The stream must be positioned at the
beginning of the file's data.streamLength
- the length of the stream, if known, otherwise -1.fileType
- the file type of the data stream.Metadata
object containing directories of tags with values and any processing errors.ImageProcessingException
- if the file type is unknown, or for general processing errors.IOException
public static Metadata readMetadata(File file) throws ImageProcessingException, IOException
file
- a file from which the image data may be read.Metadata
object containing directories of tags with values and any processing errors.ImageProcessingException
- for general processing errors.IOException
public static void main(String[] args) throws MetadataException, IOException
System.out
.
If -thumb
is passed, then any thumbnail data will be written to a file with name of the
input file having .thumb.jpg
appended.
If -markdown
is passed, then output will be in markdown format.
If -hex
is passed, then the ID of each tag will be displayed in hexadecimal.
args
- the command line argumentsMetadataException
IOException
Copyright © 2010 - 2020 Adobe. All Rights Reserved