net.sourceforge.atunes.kernel.modules.repository.audio
Class AudioFile

java.lang.Object
  extended by java.io.File
      extended by net.sourceforge.atunes.kernel.modules.repository.audio.AudioFile
All Implemented Interfaces:
java.io.Serializable, java.lang.Comparable<java.io.File>, AudioObject

public class AudioFile
extends java.io.File
implements AudioObject, java.io.Serializable

AudioFile class initializes audio files so tags and audio information can be retrieved by tagging library. Provides information about bitrate, duration and frequency of the audio file. Provides tag informations.

Author:
fleax
See Also:
Serialized Form

Field Summary
static java.lang.String APE_FORMAT
          The Constant APE_FORMAT.
static java.lang.String FLAC_FORMAT
          The Constant FLAC_FORMAT.
static java.lang.String MAC_FORMAT
          The Constant MAC_FORMAT.
static java.lang.String MP3_FORMAT
          The Constant MP3_FORMAT.
static java.lang.String MP4_FORMAT_1
          The Constant MP4_FORMAT_1.
static java.lang.String MP4_FORMAT_2
          The Constant MP4_FORMAT_2.
static java.lang.String MPC_FORMAT
          The Constant MPC_FORMAT.
static java.lang.String MPplus_FORMAT
          The Constant MPplus_FORMAT.
static java.lang.String OGG_FORMAT
          The Constant OGG_FORMAT.
static java.lang.String REALAUDIO_FORMAT
          The Constant REALAUDIO_FORMAT.
static java.lang.String REALAUDIO_FORMAT_2
          The Constant REALAUDIO_FORMAT_2.
static java.lang.String WAV_FORMAT
          The Constant WAV_FORMAT.
static java.lang.String WMA_FORMAT
          The Constant WMA_FORMAT.
 
Fields inherited from class java.io.File
pathSeparator, pathSeparatorChar, separator, separatorChar
 
Constructor Summary
AudioFile(java.lang.String fileName)
          Instantiates a new audio file.
 
Method Summary
 void addExternalPicture(java.io.File picture)
          Adds the external picture.
 boolean equals(java.lang.Object o)
           
 java.lang.String getAbsolutePath()
          Deprecated. 
 java.lang.String getAlbum()
          Gets the album.
 java.lang.String getAlbumArtist()
          Gets the album artist.
 java.lang.String getArtist()
          Gets the artist.
static java.util.List<AudioFile> getAudioFiles(java.util.List<AudioObject> audioObjects)
          Gets the audio files.
 long getBitrate()
          Gets the bitrate.
 java.lang.String getComment()
          Return tag comment
 java.lang.String getComposer()
          Gets the composer.
 long getDuration()
          Gets the duration.
 java.util.List<java.io.File> getExternalPictures()
          Gets the external pictures.
 int getExternalPicturesCount()
          Gets the external pictures count.
 int getFrequency()
          Gets the frequency.
 java.lang.String getGenre()
          Gets the genre.
 java.lang.String getLyrics()
          Gets the lyrics.
 java.lang.String getNameWithoutExtension()
          Gets the name without extension.
static Tag getNewTag(AudioFile file, java.util.Map<java.lang.String,java.lang.Object> properties)
          Gets the new tag.
 int getStars()
          Gets the stars.
 Tag getTag()
          Gets the tag.
 java.lang.String getTitle()
          Gets the title.
 java.lang.String getTitleOrFileName()
          Gets the title or file name.
 java.lang.Integer getTrackNumber()
          Gets the track number.
 java.lang.String getUrl()
          Gets the url.
 java.lang.String getYear()
          Gets the year.
 int hashCode()
           
 boolean hasInternalPicture()
          Checks for internal picture.
static boolean isApeFile(java.io.File file)
          Checks if is ape file.
static boolean isFlacFile(java.io.File file)
          Checks if is flac file.
static boolean isMp3File(java.io.File file)
          Checks if is mp3 file.
static boolean isMp4File(java.io.File file)
          Checks if is mp4 file.
static boolean isMPCFile(java.io.File file)
          Checks if is mPC file.
static boolean isOggFile(java.io.File file)
          Checks if is ogg file.
static boolean isRealAudioFile(java.io.File file)
          Checks if is real audio file.
 boolean isSeekable()
          Checks if is seekable.
 boolean isUpToDate()
          Checks if is up to date.
static boolean isValidAudioFile(java.io.File file)
          Checks if is valid audio file.
static boolean isValidAudioFile(java.lang.String file)
          Checks if is valid audio file.
static boolean isWavFile(java.io.File file)
          Checks if is wav file.
static boolean isWmaFile(java.io.File file)
          Checks if is wma file.
 void refreshTag()
          Refresh tag.
 void setExternalPictures(java.util.List<java.io.File> externalPictures)
          Sets the external pictures.
 void setStars(int stars)
          Sets the stars.
 void setTag(Tag tag)
          Sets the tag.
 void setWritable()
          Sets write permissions if is not writable.
 boolean supportsInternalPicture()
          Checks if the tag of this audio file does support internal images
 java.lang.String toString()
           
 
Methods inherited from class java.io.File
canExecute, canRead, canWrite, compareTo, createNewFile, createTempFile, createTempFile, delete, deleteOnExit, exists, getAbsoluteFile, getCanonicalFile, getCanonicalPath, getFreeSpace, getName, getParent, getParentFile, getPath, getTotalSpace, getUsableSpace, isAbsolute, isDirectory, isFile, isHidden, lastModified, length, list, list, listFiles, listFiles, listFiles, listRoots, mkdir, mkdirs, renameTo, setExecutable, setExecutable, setLastModified, setReadable, setReadable, setReadOnly, setWritable, setWritable, toURI, toURL
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

MP3_FORMAT

public static final java.lang.String MP3_FORMAT
The Constant MP3_FORMAT.

See Also:
Constant Field Values

OGG_FORMAT

public static final java.lang.String OGG_FORMAT
The Constant OGG_FORMAT.

See Also:
Constant Field Values

MP4_FORMAT_1

public static final java.lang.String MP4_FORMAT_1
The Constant MP4_FORMAT_1.

See Also:
Constant Field Values

MP4_FORMAT_2

public static final java.lang.String MP4_FORMAT_2
The Constant MP4_FORMAT_2.

See Also:
Constant Field Values

WAV_FORMAT

public static final java.lang.String WAV_FORMAT
The Constant WAV_FORMAT.

See Also:
Constant Field Values

WMA_FORMAT

public static final java.lang.String WMA_FORMAT
The Constant WMA_FORMAT.

See Also:
Constant Field Values

FLAC_FORMAT

public static final java.lang.String FLAC_FORMAT
The Constant FLAC_FORMAT.

See Also:
Constant Field Values

APE_FORMAT

public static final java.lang.String APE_FORMAT
The Constant APE_FORMAT.

See Also:
Constant Field Values

MPC_FORMAT

public static final java.lang.String MPC_FORMAT
The Constant MPC_FORMAT.

See Also:
Constant Field Values

REALAUDIO_FORMAT

public static final java.lang.String REALAUDIO_FORMAT
The Constant REALAUDIO_FORMAT.

See Also:
Constant Field Values

REALAUDIO_FORMAT_2

public static final java.lang.String REALAUDIO_FORMAT_2
The Constant REALAUDIO_FORMAT_2.

See Also:
Constant Field Values

MPplus_FORMAT

public static final java.lang.String MPplus_FORMAT
The Constant MPplus_FORMAT.

See Also:
Constant Field Values

MAC_FORMAT

public static final java.lang.String MAC_FORMAT
The Constant MAC_FORMAT.

See Also:
Constant Field Values
Constructor Detail

AudioFile

public AudioFile(java.lang.String fileName)
Instantiates a new audio file.

Parameters:
fileName - the file name
Method Detail

getAudioFiles

public static java.util.List<AudioFile> getAudioFiles(java.util.List<AudioObject> audioObjects)
Gets the audio files.

Parameters:
audioObjects - the audio objects
Returns:
the audio files

getNewTag

public static Tag getNewTag(AudioFile file,
                            java.util.Map<java.lang.String,java.lang.Object> properties)
Gets the new tag.

Parameters:
file - the file
properties - the properties
Returns:
the new tag

isApeFile

public static boolean isApeFile(java.io.File file)
Checks if is ape file.

Parameters:
file - the file
Returns:
true, if is ape file

isFlacFile

public static boolean isFlacFile(java.io.File file)
Checks if is flac file.

Parameters:
file - the file
Returns:
true, if is flac file

isMp3File

public static boolean isMp3File(java.io.File file)
Checks if is mp3 file.

Parameters:
file - the file
Returns:
true, if is mp3 file

isMp4File

public static boolean isMp4File(java.io.File file)
Checks if is mp4 file.

Parameters:
file - the file
Returns:
true, if is mp4 file

isMPCFile

public static boolean isMPCFile(java.io.File file)
Checks if is mPC file.

Parameters:
file - the file
Returns:
true, if is mPC file

isOggFile

public static boolean isOggFile(java.io.File file)
Checks if is ogg file.

Parameters:
file - the file
Returns:
true, if is ogg file

isRealAudioFile

public static boolean isRealAudioFile(java.io.File file)
Checks if is real audio file.

Parameters:
file - the file
Returns:
true, if is real audio file

isValidAudioFile

public static boolean isValidAudioFile(java.io.File file)
Checks if is valid audio file.

Parameters:
file - the file
Returns:
true, if is valid audio file

isValidAudioFile

public static boolean isValidAudioFile(java.lang.String file)
Checks if is valid audio file.

Parameters:
file - the file
Returns:
true, if is valid audio file

isWavFile

public static boolean isWavFile(java.io.File file)
Checks if is wav file.

Parameters:
file - the file
Returns:
true, if is wav file

isWmaFile

public static boolean isWmaFile(java.io.File file)
Checks if is wma file.

Parameters:
file - the file
Returns:
true, if is wma file

addExternalPicture

public void addExternalPicture(java.io.File picture)
Adds the external picture.

Parameters:
picture - the picture

equals

public boolean equals(java.lang.Object o)
Overrides:
equals in class java.io.File

getAbsolutePath

@Deprecated
public java.lang.String getAbsolutePath()
Deprecated. 

Overrides:
getAbsolutePath in class java.io.File

getAlbum

public java.lang.String getAlbum()
Description copied from interface: AudioObject
Gets the album.

Specified by:
getAlbum in interface AudioObject
Returns:
the album

getAlbumArtist

public java.lang.String getAlbumArtist()
Description copied from interface: AudioObject
Gets the album artist.

Specified by:
getAlbumArtist in interface AudioObject
Returns:
the album artist

getArtist

public java.lang.String getArtist()
Description copied from interface: AudioObject
Gets the artist.

Specified by:
getArtist in interface AudioObject
Returns:
the artist

getBitrate

public long getBitrate()
Description copied from interface: AudioObject
Gets the bitrate.

Specified by:
getBitrate in interface AudioObject
Returns:
the bitrate

getComposer

public java.lang.String getComposer()
Description copied from interface: AudioObject
Gets the composer.

Specified by:
getComposer in interface AudioObject
Returns:
the composer

getDuration

public long getDuration()
Description copied from interface: AudioObject
Gets the duration.

Specified by:
getDuration in interface AudioObject
Returns:
the duration

getExternalPictures

public java.util.List<java.io.File> getExternalPictures()
Gets the external pictures.

Returns:
the external pictures

getExternalPicturesCount

public int getExternalPicturesCount()
Gets the external pictures count.

Returns:
the external pictures count

getFrequency

public int getFrequency()
Description copied from interface: AudioObject
Gets the frequency.

Specified by:
getFrequency in interface AudioObject
Returns:
the frequency

getGenre

public java.lang.String getGenre()
Description copied from interface: AudioObject
Gets the genre.

Specified by:
getGenre in interface AudioObject
Returns:
the genre

getLyrics

public java.lang.String getLyrics()
Description copied from interface: AudioObject
Gets the lyrics.

Specified by:
getLyrics in interface AudioObject
Returns:
the lyrics

getComment

public java.lang.String getComment()
Return tag comment

Returns:

getNameWithoutExtension

public java.lang.String getNameWithoutExtension()
Gets the name without extension.

Returns:
the name without extension

getStars

public int getStars()
Gets the stars.

Specified by:
getStars in interface AudioObject
Returns:
the stars

getTag

public Tag getTag()
Gets the tag.

Returns:
the tag

getTitle

public java.lang.String getTitle()
Description copied from interface: AudioObject
Gets the title.

Specified by:
getTitle in interface AudioObject
Returns:
the title

getTitleOrFileName

public java.lang.String getTitleOrFileName()
Description copied from interface: AudioObject
Gets the title or file name.

Specified by:
getTitleOrFileName in interface AudioObject
Returns:
the title or file name

getTrackNumber

public java.lang.Integer getTrackNumber()
Description copied from interface: AudioObject
Gets the track number.

Specified by:
getTrackNumber in interface AudioObject
Returns:
the track number

getUrl

public java.lang.String getUrl()
Description copied from interface: AudioObject
Gets the url.

Specified by:
getUrl in interface AudioObject
Returns:
the url

getYear

public java.lang.String getYear()
Description copied from interface: AudioObject
Gets the year.

Specified by:
getYear in interface AudioObject
Returns:
the year

hashCode

public int hashCode()
Overrides:
hashCode in class java.io.File

hasInternalPicture

public final boolean hasInternalPicture()
Checks for internal picture.

Returns:
true, if successful

supportsInternalPicture

public final boolean supportsInternalPicture()
Checks if the tag of this audio file does support internal images

Returns:
if the tag of this audio file does support internal images

isUpToDate

public boolean isUpToDate()
Checks if is up to date.

Returns:
true, if is up to date

refreshTag

public void refreshTag()
Refresh tag.


setExternalPictures

public void setExternalPictures(java.util.List<java.io.File> externalPictures)
Sets the external pictures.

Parameters:
externalPictures - the new external pictures

setStars

public void setStars(int stars)
Sets the stars.

Specified by:
setStars in interface AudioObject
Parameters:
stars - the stars to set

setTag

public void setTag(Tag tag)
Sets the tag.

Parameters:
tag - the new tag

setWritable

public void setWritable()
Sets write permissions if is not writable.


toString

public java.lang.String toString()
Overrides:
toString in class java.io.File

isSeekable

public boolean isSeekable()
Description copied from interface: AudioObject
Checks if is seekable.

Specified by:
isSeekable in interface AudioObject
Returns:
true, if is seekable


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