public class ImageMetadataReader
extends java.lang.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:
JpegMetadataReader for JPEG filesTiffMetadataReader for TIFF and (most) RAW filesPsdMetadataReader for Photoshop filesPngMetadataReader for PNG filesBmpMetadataReader for BMP filesGifMetadataReader for GIF filesIcoMetadataReader for ICO filesPcxMetadataReader for PCX filesWebpMetadataReader for WebP filesRafMetadataReader for RAF files
FileTypeDetector is used to determine the provided image's file type, and therefore
the appropriate metadata reader to use.
| Modifier | Constructor and Description |
|---|---|
private |
ImageMetadataReader() |
| Modifier and Type | Method and Description |
|---|---|
static void |
main(java.lang.String[] args)
An application entry point.
|
static Metadata |
readMetadata(java.io.File file)
Reads
Metadata from a File object. |
static Metadata |
readMetadata(java.io.InputStream inputStream)
Reads metadata from an
InputStream. |
static Metadata |
readMetadata(java.io.InputStream inputStream,
long streamLength)
Reads metadata from an
InputStream of known length. |
private ImageMetadataReader()
throws java.lang.Exception
java.lang.Exceptionpublic static Metadata readMetadata(java.io.InputStream inputStream) throws ImageProcessingException, java.io.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.java.io.IOExceptionpublic static Metadata readMetadata(java.io.InputStream inputStream, long streamLength) throws ImageProcessingException, java.io.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.java.io.IOExceptionpublic static Metadata readMetadata(java.io.File file) throws ImageProcessingException, java.io.IOException
Metadata from a File object.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.java.io.IOExceptionpublic static void main(java.lang.String[] args)
throws MetadataException,
java.io.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 argumentsMetadataExceptionjava.io.IOException