entagged.audioformats
Class AudioFile

java.lang.Object
  extended by java.io.File
      extended by entagged.audioformats.AudioFile
All Implemented Interfaces:
Serializable, Comparable<File>

public class AudioFile
extends File

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 infos, 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.1 2007/03/23 14:16:56 nicov1 Exp $
Author:
Raphael Slinckx
See Also:
AudioFileIO, Tag, Serialized Form

Field Summary
 
Fields inherited from class java.io.File
pathSeparator, pathSeparatorChar, separator, separatorChar
 
Constructor Summary
AudioFile(File f, EncodingInfo info)
          These constructors are used by the different readers, users should not use them, but use the AudioFileIO.read(File) method instead !.
AudioFile(File f, EncodingInfo info, 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
 int getBitrate()
          Returns the bitrate of this AufioFile in kilobytes per second (KB/s).
 int getChannelNumber()
          Returns the number of audio channels contained in this AudioFile, 2 for example means stereo
 String getEncodingType()
          Returns the encoding type of this AudioFile, this needs to be precisely specified in the future
 String getExtraEncodingInfos()
          Returns the extra encoding infos of this AudioFile, this needs to be precisely specified in the future
 int getID()
           
 int getLength()
          Returns the length (duration) in seconds (s) of this AudioFile.Example: 241 seconds
 float getPreciseLength()
          Returns the length (duration) in seconds with fractions.
 int getSamplingRate()
          Returns the sampling rate of this AudioFile in Hertz (Hz).
 Tag getTag()
          Returns the tag contained in this AudioFile, the Tag contains any useful meta-data, like artist, album, title, etc.
 boolean isVbr()
          Checks if this file is a VBR (variable bitrate) or a Constant Bitrate one
 void setID(int id)
           
 String toString()
          Returns a multi-line string with the file path, the encoding informations, and the tag contents.
 
Methods inherited from class java.io.File
canExecute, canRead, canWrite, compareTo, createNewFile, createTempFile, createTempFile, delete, deleteOnExit, equals, exists, getAbsoluteFile, getAbsolutePath, getCanonicalFile, getCanonicalPath, getFreeSpace, getName, getParent, getParentFile, getPath, getTotalSpace, getUsableSpace, hashCode, 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
 

Constructor Detail

AudioFile

public AudioFile(File f,
                 EncodingInfo info)

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 encodinginfos and containing an empty tag

Parameters:
f - The file of the audiofile
info - the encoding infos over this file

AudioFile

public AudioFile(File f,
                 EncodingInfo info,
                 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 encodinginfos and containing the tag

Parameters:
f - The file of the audiofile
info - the encoding infos over this file
tag - the tag contained in this file
Method Detail

getBitrate

public int getBitrate()

Returns the bitrate of this AufioFile in kilobytes per second (KB/s). Example: 192 KB/s

Returns:
Returns the bitrate of this AufioFile

getChannelNumber

public int getChannelNumber()

Returns the number of audio channels contained in this AudioFile, 2 for example means stereo

Returns:
Returns the number of audio channels contained in this AudioFile

getEncodingType

public String getEncodingType()

Returns the encoding type of this AudioFile, this needs to be precisely specified in the future

Returns:
Returns the encoding type of this AudioFile

getExtraEncodingInfos

public String getExtraEncodingInfos()

Returns the extra encoding infos of this AudioFile, this needs to be precisely specified in the future

Returns:
Returns the extra encoding infos of this AudioFile

getLength

public int getLength()

Returns the length (duration) in seconds (s) of this AudioFile.Example: 241 seconds

Returns:
Returns the length (duration) of this AudioFile

getPreciseLength

public float getPreciseLength()
Returns the length (duration) in seconds with fractions.

Returns:
The duration in seconds.

getSamplingRate

public int getSamplingRate()

Returns the sampling rate of this AudioFile in Hertz (Hz). Example: 44100 Hz for most of the audio files

Returns:
Returns the sampling rate of this AudioFile

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, a new empty tag is returned

Returns:
Returns the tag contained in this AudioFile, or a new one if file hasn't any tag.

isVbr

public boolean isVbr()

Checks if this file is a VBR (variable bitrate) or a Constant Bitrate one

True means VBR, false means CBR

This has only meaning with MP3 and MPC files, other formats are always VBR since it offers a better compression ratio (and lossless compression is by nature VBR


toString

public String toString()

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

Overrides:
toString in class File
Returns:
A multi-line string with the file path, the encoding informations, and the tag contents.

setID

public void setID(int id)
Parameters:
id -

getID

public int getID()
Returns:


Copyright © 2007-2008. All Rights Reserved.