org.jaudiotagger.audio
Class AudioFile

java.lang.Object
  extended by org.jaudiotagger.audio.AudioFile
Direct Known Subclasses:
MP3File

public class AudioFile
extends java.lang.Object

This is the main object manipulated by the user representing an audiofile, its properties and its tag.

The prefered way to obtain an AudioFile is to use the AudioFileIO.read(File) method.

The AudioFile contains every properties associated with the file itself (no meta-data), like the bitrate, the sampling rate, the encoding audioHeaders, etc.

To get the meta-data contained in this file you have to get the Tag of this AudioFile

Since:
v0.01
Version:
$Id: AudioFile.java,v 1.6 2007/11/26 17:22:19 paultaylor Exp $
Author:
Raphael Slinckx
See Also:
AudioFileIO, Tag

Field Summary
static java.util.logging.Logger logger
           
 
Constructor Summary
AudioFile()
           
AudioFile(java.io.File f, AudioHeader audioHeader, Tag tag)
          These constructors are used by the different readers, users should not use them, but use the AudioFileIO.read(File) method instead !.
AudioFile(java.lang.String s, AudioHeader audioHeader, Tag tag)
          These constructors are used by the different readers, users should not use them, but use the AudioFileIO.read(File) method instead !.
 
Method Summary
 void commit()
          Write the tag contained in this AudioFile in the actual file on the disk, this is the same as calling the AudioFileIO.write(this) method.
 java.lang.String displayStructureAsPlainText()
          Optional debugging method
 java.lang.String displayStructureAsXML()
          Optional debugging method
 AudioHeader getAudioHeader()
          Return audio header
 java.io.File getFile()
          Retrieve the physical file
 Tag getTag()
          Returns the tag contained in this AudioFile, the Tag contains any useful meta-data, like artist, album, title, etc.
 void setFile(java.io.File file)
          Set the file to store the info in
 void setTag(Tag tag)
           
 java.lang.String toString()
          Returns a multi-line string with the file path, the encoding audioHeaderrmations, and the tag contents.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

logger

public static java.util.logging.Logger logger
Constructor Detail

AudioFile

public AudioFile()

AudioFile

public AudioFile(java.io.File f,
                 AudioHeader audioHeader,
                 Tag tag)

These constructors are used by the different readers, users should not use them, but use the AudioFileIO.read(File) method instead !.

Create the AudioFile representing file f, the encodingaudioHeaders and containing the tag

Parameters:
f - The file of the audiofile
audioHeader - the encoding audioHeaders over this file
tag - the tag contained in this file or null if no tag exists

AudioFile

public AudioFile(java.lang.String s,
                 AudioHeader audioHeader,
                 Tag tag)

These constructors are used by the different readers, users should not use them, but use the AudioFileIO.read(File) method instead !.

Create the AudioFile representing file denoted by pathname s, the encodingaudioHeaders and containing the tag

Parameters:
s - The pathname of the audiofile
audioHeader - the encoding audioHeaders over this file
tag - the tag contained in this file
Method Detail

commit

public void commit()
            throws CannotWriteException

Write the tag contained in this AudioFile in the actual file on the disk, this is the same as calling the AudioFileIO.write(this) method.

Throws:
CannotWriteException - If the file could not be written/accessed, the extension wasn't recognized, or other IO error occured.
See Also:
AudioFileIO

setFile

public void setFile(java.io.File file)
Set the file to store the info in

Parameters:
file -

getFile

public java.io.File getFile()
Retrieve the physical file

Returns:

setTag

public void setTag(Tag tag)

getAudioHeader

public AudioHeader getAudioHeader()
Return audio header


getTag

public Tag getTag()

Returns the tag contained in this AudioFile, the Tag contains any useful meta-data, like artist, album, title, etc. If the file does not contain any tag the null is returned. Some audio formats do not allow there to be no tag so in this case the reader would return an empty tag whereas for others such as mp3 it is purely optional.

Returns:
Returns the tag contained in this AudioFile, or null if no tag exists.

toString

public java.lang.String toString()

Returns a multi-line string with the file path, the encoding audioHeaderrmations, and the tag contents.

Overrides:
toString in class java.lang.Object
Returns:
A multi-line string with the file path, the encoding audioHeaderrmations, and the tag contents. TODO Maybe this can be changed ?

displayStructureAsXML

public java.lang.String displayStructureAsXML()
Optional debugging method

Returns:

displayStructureAsPlainText

public java.lang.String displayStructureAsPlainText()
Optional debugging method

Returns: