magoffin.matt.meta.audio
Class ID3v2_2MetadataResource

java.lang.Object
  extended by magoffin.matt.meta.support.AbstractMetadataResource
      extended by magoffin.matt.meta.support.AbstractEnumMetadataResource<AudioMetadataType>
          extended by magoffin.matt.meta.audio.ID3v2_2MetadataResource
All Implemented Interfaces:
AudioMetadataResource, MetadataResource
Direct Known Subclasses:
ID3v2_3MetadataResource

public class ID3v2_2MetadataResource
extends AbstractEnumMetadataResource<AudioMetadataType>
implements AudioMetadataResource

MetadataResource implementation for ID3v2 resources.

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

Field Summary
 
Fields inherited from class magoffin.matt.meta.support.AbstractMetadataResource
log
 
Constructor Summary
ID3v2_2MetadataResource(java.io.RandomAccessFile file)
          Construct with a RandomAccessFile.
 
Method Summary
protected  java.io.RandomAccessFile getFile()
           
protected  MP3Tag getMP3Tag(java.io.RandomAccessFile mp3File)
          Get a MP3Tag implementation for a file.
protected  MP3AudioMetadata getMpegAudioMetadata(java.io.RandomAccessFile mp3File)
          Get a MP3AudioMetadata for a file.
protected  void handleAlbumCover(MP3Tag id3)
          Extract a MetadataImage for the AudioMetadataType.ALBUM_COVER.
protected  void parseMetadata(MP3AudioMetadata mp3, MP3Tag id3)
          Parse the metadata from the MP3 audio and MP3 tags.
 
Methods inherited from class magoffin.matt.meta.support.AbstractEnumMetadataResource
addError, addValue, getValue, getValues, setValue, setValues
 
Methods inherited from class magoffin.matt.meta.support.AbstractMetadataResource
addError, addValue, clearValues, getParsedKeys, getParseErrors, getValue, getValueList, getValues, setValue, setValues
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface magoffin.matt.meta.audio.AudioMetadataResource
getValue, getValues
 
Methods inherited from interface magoffin.matt.meta.MetadataResource
getParsedKeys, getParseErrors, getValue, getValues
 

Constructor Detail

ID3v2_2MetadataResource

public ID3v2_2MetadataResource(java.io.RandomAccessFile file)
                        throws java.io.IOException
Construct with a RandomAccessFile.

Parameters:
file - the file
Throws:
java.io.IOException - if an error occurs
Method Detail

parseMetadata

protected void parseMetadata(MP3AudioMetadata mp3,
                             MP3Tag id3)
Parse the metadata from the MP3 audio and MP3 tags.

Parameters:
mp3 - the MP3 audio metadata
id3 - the MP3 tag metadata

handleAlbumCover

protected void handleAlbumCover(MP3Tag id3)
Extract a MetadataImage for the AudioMetadataType.ALBUM_COVER.

This implementation looks for a MP3MetadataItem with the ID PIC and extracts the picture data from there.

Parameters:
id3 - the ID3 tag data to extract from

getMP3Tag

protected MP3Tag getMP3Tag(java.io.RandomAccessFile mp3File)
                    throws java.io.IOException
Get a MP3Tag implementation for a file.

Parameters:
mp3File - the file
Returns:
the MP3Tag implementation
Throws:
java.io.IOException - if an IO error occurs

getMpegAudioMetadata

protected MP3AudioMetadata getMpegAudioMetadata(java.io.RandomAccessFile mp3File)
                                         throws java.io.IOException
Get a MP3AudioMetadata for a file.

Parameters:
mp3File - the file
Returns:
the audio metadata
Throws:
java.io.IOException - if an IO error occurs

getFile

protected java.io.RandomAccessFile getFile()
Returns:
the file