magoffin.matt.meta
Interface MetadataResource

All Known Subinterfaces:
AudioMetadataResource, ImageMetadataResource, VideoMetadataResource
All Known Implementing Classes:
AbstractEnumMetadataResource, AbstractMetadataResource, AbstractVideoMetadataResource, Canon, Canon20D, CanonG5, EXIFJpegMetadataResource, ID3v1_1MetadataResource, ID3v1MetadataResource, ID3v2_2MetadataResource, ID3v2_3MetadataResource, ID3v2_4MetadataResource, JMFMetadataResource, PNGMetadataResource, QuickTimeMetadataResource

public interface MetadataResource

Generic metadata extraction API.

Version:
$Revision: 3 $ $Date: 2008-12-27 08:09:28 +1300 (Sat, 27 Dec 2008) $
Author:
Matt Magoffin (spamsqr@msqr.us)

Method Summary
 java.lang.Iterable<java.lang.String> getParsedKeys()
          Get an Iterable of all successfully parsed metadata keys.
 java.util.Map<java.lang.String,java.util.List<java.lang.String>> getParseErrors()
          Get a Map of errors that occured while parsing the metadata resource.
 java.lang.Object getValue(java.lang.String key, java.util.Locale locale)
          Get a single metadata value based on an arbitrary key.
 java.lang.Iterable<?> getValues(java.lang.String key, java.util.Locale locale)
          Get all available metadata values based on an arbitrary key.
 

Method Detail

getValue

java.lang.Object getValue(java.lang.String key,
                          java.util.Locale locale)
Get a single metadata value based on an arbitrary key.

Keys are implementation specific. If more than one metadata of the specified key is available, this will return the first available one.

An optional Locale parameter may be provided. Some metadata values might have Locale-specific variations. The Locale parameter may be null in which case the platform's default Locale will be used.

Parameters:
key - the key
locale - a Locale
Returns:
the value, or null if not available

getValues

java.lang.Iterable<?> getValues(java.lang.String key,
                                java.util.Locale locale)
Get all available metadata values based on an arbitrary key.

Keys are implementation specific.

An optional Locale parameter may be provided. Some metadata values might have Locale-specific variations. The Locale parameter may be null in which case the platform's default Locale will be used.

Parameters:
key - the key
locale - a Locale
Returns:
iterable for all values, never null

getParsedKeys

java.lang.Iterable<java.lang.String> getParsedKeys()
Get an Iterable of all successfully parsed metadata keys.

No sorting should be implied by the returned Iterator, but implementations are free to order the results in any way they see fit.

Returns:
Iterator, never null

getParseErrors

java.util.Map<java.lang.String,java.util.List<java.lang.String>> getParseErrors()
Get a Map of errors that occured while parsing the metadata resource.

The Map has keys based on the metadata names, and the List associated with each key holds the error message(s) that occurred while processing the metadata values for that key.

If no errors occurred while processing, this will return an empty Map (never null).

Returns:
error map