|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.jaudiotagger.audio.AudioFile
public class AudioFile
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
AudioFileIO
,
Tag
Field Summary | |
---|---|
protected AudioHeader |
audioHeader
The Audio header info |
protected java.io.File |
file
The physical file that this instance represents. |
static java.util.logging.Logger |
logger
|
protected Tag |
tag
The tag |
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 | |
---|---|
protected java.io.RandomAccessFile |
checkFilePermissions(java.io.File file,
boolean readOnly)
Checks the file is accessible with the correct permissions, otherwise exception occurs |
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. |
Tag |
createDefaultTag()
Create Default Tag |
java.lang.String |
displayStructureAsPlainText()
Optional debugging method |
java.lang.String |
displayStructureAsXML()
Optional debugging method |
AudioHeader |
getAudioHeader()
Return audio header |
static java.lang.String |
getBaseFilename(java.io.File file)
|
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. |
Tag |
getTagOrCreateAndSetDefault()
Get the tag or if the file doesnt have one at all, create a default tag and set it |
Tag |
getTagOrCreateDefault()
Get the tag or if the file doesnt have one at all, create a default tag and return |
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 |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static java.util.logging.Logger logger
protected java.io.File file
protected AudioHeader audioHeader
protected Tag tag
Constructor Detail |
---|
public 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
f
- The file of the audiofileaudioHeader
- the encoding audioHeaders over this filetag
- the tag contained in this file or null if no tag existspublic 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
s
- The pathname of the audiofileaudioHeader
- the encoding audioHeaders over this filetag
- the tag contained in this fileMethod Detail |
---|
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.
CannotWriteException
- If the file could not be written/accessed, the extension wasn't recognized, or other IO error occured.AudioFileIO
public void setFile(java.io.File file)
file
- public java.io.File getFile()
public void setTag(Tag tag)
public AudioHeader getAudioHeader()
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.
public java.lang.String toString()
Returns a multi-line string with the file path, the encoding audioHeaderrmations, and the tag contents.
toString
in class java.lang.Object
protected java.io.RandomAccessFile checkFilePermissions(java.io.File file, boolean readOnly) throws ReadOnlyFileException, java.io.FileNotFoundException
file
- readOnly
-
ReadOnlyFileException
java.io.FileNotFoundException
public java.lang.String displayStructureAsXML()
public java.lang.String displayStructureAsPlainText()
public Tag createDefaultTag()
public Tag getTagOrCreateDefault()
public Tag getTagOrCreateAndSetDefault()
public static java.lang.String getBaseFilename(java.io.File file)
file
-
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |