net.sourceforge.atunes.kernel.utils
Class AudioFilePictureUtils

java.lang.Object
  extended by net.sourceforge.atunes.kernel.utils.AudioFilePictureUtils

public class AudioFilePictureUtils
extends java.lang.Object

This class gets images associated to audio files Images can be internal (like in ID3v2) or external (in the same folder than audio file).

Author:
fleax

Constructor Summary
AudioFilePictureUtils()
           
 
Method Summary
static void exportPicture(AudioFile song)
          Export picture.
static java.lang.String getFileNameForCover(AudioFile file)
          Returns a file name to save an external image associated to an audio file.
static javax.swing.ImageIcon getImageForAudioFile(AudioFile file, int width, int height)
          Returns an image associated to an audio file, with following order: - If a image saved by aTunes exists, then return it. - If not, find an internal image - If not, find an external image - If not, return null
static javax.swing.ImageIcon[] getPicturesForFile(AudioFile file, int width, int height)
          Returns all pictures associated to an audio file.
static boolean isValidPicture(java.io.File file)
          Returns true if file represents a valid picture (jpg or png).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AudioFilePictureUtils

public AudioFilePictureUtils()
Method Detail

exportPicture

public static void exportPicture(AudioFile song)
                          throws java.io.FileNotFoundException,
                                 java.io.IOException
Export picture.

Parameters:
song - the song
Throws:
java.io.FileNotFoundException - the file not found exception
java.io.IOException - Signals that an I/O exception has occurred.

getFileNameForCover

public static java.lang.String getFileNameForCover(AudioFile file)
Returns a file name to save an external image associated to an audio file.

Parameters:
file - the file
Returns:
the file name for cover

getImageForAudioFile

public static javax.swing.ImageIcon getImageForAudioFile(AudioFile file,
                                                         int width,
                                                         int height)
Returns an image associated to an audio file, with following order: - If a image saved by aTunes exists, then return it. - If not, find an internal image - If not, find an external image - If not, return null

Parameters:
file - Audio File
width - Width in pixels or -1 to keep original width
height - Height in pixels or -1 to keep original height
Returns:
the image for audio file

getPicturesForFile

public static javax.swing.ImageIcon[] getPicturesForFile(AudioFile file,
                                                         int width,
                                                         int height)
Returns all pictures associated to an audio file.

Parameters:
file - the file
width - Width in pixels or -1 to keep original width
height - Height in pixels or -1 to keep original height
Returns:
the pictures for file

isValidPicture

public static boolean isValidPicture(java.io.File file)
Returns true if file represents a valid picture (jpg or png).

Parameters:
file - the file
Returns:
true, if checks if is valid picture


Copyright © 2006-2008 The aTunes Team. All Rights Reserved.