|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jaudiotagger.audio.AudioFile
org.jaudiotagger.audio.mp3.MP3File
public class MP3File
This class represents a physical MP3 File
Field Summary | |
---|---|
private ID3v1Tag |
id3v1tag
The ID3v1 tag that this file contains. |
private ID3v24Tag |
id3v2Asv24tag
Representation of the idv2 tag as a idv24 tag |
private AbstractID3v2Tag |
id3v2tag
the ID3v2 tag that this file contains. |
static int |
LOAD_ALL
|
static int |
LOAD_IDV1TAG
|
static int |
LOAD_IDV2TAG
|
static int |
LOAD_LYRICS3
This option is currently ignored |
private AbstractLyrics3 |
lyrics3tag
The Lyrics3 tag that this file contains. |
private static int |
MINIMUM_FILESIZE
|
protected static AbstractTagDisplayFormatter |
tagFormatter
|
Fields inherited from class org.jaudiotagger.audio.AudioFile |
---|
audioHeader, file, logger, tag |
Constructor Summary | |
---|---|
MP3File()
Creates a new empty MP3File datatype that is not associated with a specific file. |
|
MP3File(java.io.File file)
Creates a new MP3File datatype and parse the tag from the given file Object. |
|
MP3File(java.io.File file,
int loadOptions)
Creates a new MP3File datatype and parse the tag from the given file Object, files must be writable to use this constructor. |
|
MP3File(java.io.File file,
int loadOptions,
boolean readOnly)
Creates a new MP3File datatype and parse the tag from the given file Object, files can be onpened read only if required. |
|
MP3File(java.lang.String filename)
Creates a new MP3File datatype and parse the tag from the given filename. |
Method Summary | |
---|---|
private MP3AudioHeader |
checkAudioStart(long startByte,
MP3AudioHeader currentHeader)
Regets the audio header starting from start of file, and write appropriate logging to indicate potential problem to user. |
void |
commit()
Overriden for comptability with merged code |
Tag |
createDefaultTag()
Create Default Tag |
private static void |
createPlainTextStructureFormatter()
|
private static void |
createXMLStructureFormatter()
|
void |
delete(AbstractTag mp3tag)
Remove tag from file |
java.lang.String |
displayStructureAsPlainText()
Displays MP3File Structure |
java.lang.String |
displayStructureAsXML()
Displays MP3File Structure |
java.io.File |
extractID3v2TagDataIntoFile(java.io.File outputFile)
Extracts the raw ID3v2 tag data into a file. |
ID3v1Tag |
getID3v1Tag()
Returns the ID3v1 tag for this datatype. |
AbstractID3v2Tag |
getID3v2Tag()
Returns the ID3v2 tag for this datatype. |
ID3v24Tag |
getID3v2TagAsv24()
|
MP3AudioHeader |
getMP3AudioHeader()
Return audio header |
long |
getMP3StartByte(java.io.File file)
Used by tags when writing to calculate the location of the music file |
static AbstractTagDisplayFormatter |
getStructureFormatter()
|
boolean |
hasID3v1Tag()
Returns true if this datatype contains an Id3v1 tag |
boolean |
hasID3v2Tag()
Returns true if this datatype contains an Id3v2 tag |
void |
precheck(java.io.File file)
Check can write to file |
private void |
readLyrics3Tag(java.io.File file,
java.io.RandomAccessFile newFile,
int loadOptions)
Read lyrics3 Tag TODO:not working |
private void |
readV1Tag(java.io.File file,
java.io.RandomAccessFile newFile,
int loadOptions)
Read v1 tag |
private void |
readV2Tag(java.io.File file,
int loadOptions)
Read V2tag if exists TODO:shouldnt we be handing TagExceptions:when will they be thrown |
void |
save()
Saves the tags in this datatype to the file referred to by this datatype. |
void |
save(java.io.File file)
Saves the tags in this datatype to the file argument. |
void |
setID3v1Tag(AbstractTag mp3tag)
Sets the ID3v1 tag for this datatype. |
void |
setID3v1Tag(ID3v1Tag id3v1tag)
Sets the ID3v1(_1)tag to the tag provided as an argument. |
void |
setID3v1Tag(Tag id3v1tag)
|
void |
setID3v2Tag(AbstractID3v2Tag id3v2tag)
Sets the v2 tag to the v2 tag provided as an argument. |
void |
setID3v2Tag(AbstractTag mp3tag)
Sets the ID3v2 tag for this datatype. |
void |
setID3v2TagOnly(AbstractID3v2Tag id3v2tag)
Set v2 tag ,dont need to set v24 tag because saving TODO temp its rather messy |
void |
setTag(Tag tag)
Set the Tag If the parameter tag is a v1tag then the v1 tag is set if v2tag then the v2tag. |
Methods inherited from class org.jaudiotagger.audio.AudioFile |
---|
checkFilePermissions, getAudioHeader, getBaseFilename, getFile, getTag, getTagOrCreateAndSetDefault, getTagOrCreateDefault, setFile, toString |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
private static final int MINIMUM_FILESIZE
protected static AbstractTagDisplayFormatter tagFormatter
private AbstractID3v2Tag id3v2tag
private ID3v24Tag id3v2Asv24tag
private AbstractLyrics3 lyrics3tag
private ID3v1Tag id3v1tag
public static final int LOAD_IDV1TAG
public static final int LOAD_IDV2TAG
public static final int LOAD_LYRICS3
public static final int LOAD_ALL
Constructor Detail |
---|
public MP3File()
public MP3File(java.lang.String filename) throws java.io.IOException, TagException, ReadOnlyFileException, InvalidAudioFrameException
filename
- MP3 file
java.io.IOException
- on any I/O error
TagException
- on any exception generated by this library.
ReadOnlyFileException
InvalidAudioFrameException
public MP3File(java.io.File file, int loadOptions) throws java.io.IOException, TagException, ReadOnlyFileException, InvalidAudioFrameException
file
- MP3 fileloadOptions
- decide what tags to load
java.io.IOException
- on any I/O error
TagException
- on any exception generated by this library.
ReadOnlyFileException
InvalidAudioFrameException
public MP3File(java.io.File file, int loadOptions, boolean readOnly) throws java.io.IOException, TagException, ReadOnlyFileException, InvalidAudioFrameException
file
- MP3 fileloadOptions
- decide what tags to loadreadOnly
- causes the files to be opened readonly
java.io.IOException
- on any I/O error
TagException
- on any exception generated by this library.
ReadOnlyFileException
InvalidAudioFrameException
public MP3File(java.io.File file) throws java.io.IOException, TagException, ReadOnlyFileException, InvalidAudioFrameException
file
- MP3 file
java.io.IOException
- on any I/O error
TagException
- on any exception generated by this library.
ReadOnlyFileException
InvalidAudioFrameException
Method Detail |
---|
private void readV1Tag(java.io.File file, java.io.RandomAccessFile newFile, int loadOptions) throws java.io.IOException
file
- newFile
- loadOptions
-
java.io.IOException
private void readV2Tag(java.io.File file, int loadOptions) throws java.io.IOException, TagException
file
- loadOptions
-
java.io.IOException
TagException
private void readLyrics3Tag(java.io.File file, java.io.RandomAccessFile newFile, int loadOptions) throws java.io.IOException
file
- newFile
- loadOptions
-
java.io.IOException
private MP3AudioHeader checkAudioStart(long startByte, MP3AudioHeader currentHeader) throws java.io.IOException, InvalidAudioFrameException
startByte
- currentHeader
-
java.io.IOException
InvalidAudioFrameException
public long getMP3StartByte(java.io.File file) throws InvalidAudioFrameException, java.io.IOException
file
-
java.io.IOException
InvalidAudioFrameException
public java.io.File extractID3v2TagDataIntoFile(java.io.File outputFile) throws TagNotFoundException, java.io.IOException
outputFile
- to write the data to
TagNotFoundException
java.io.IOException
public MP3AudioHeader getMP3AudioHeader()
public boolean hasID3v1Tag()
Id3v1
tag
Id3v1
tagpublic boolean hasID3v2Tag()
Id3v2
tag
Id3v2
tagpublic void setID3v1Tag(ID3v1Tag id3v1tag)
id3v1tag
- public void setID3v1Tag(Tag id3v1tag)
public void setID3v1Tag(AbstractTag mp3tag)
ID3v1
tag for this datatype. A new
ID3v1_1
datatype is created from the argument and then used
here.
mp3tag
- Any MP3Tag datatype can be used and will be converted into a
new ID3v1_1 datatype.public ID3v1Tag getID3v1Tag()
ID3v1
tag for this datatype.
ID3v1
tag for this datatypepublic void setID3v2Tag(AbstractTag mp3tag)
ID3v2
tag for this datatype. A new
ID3v2_4
datatype is created from the argument and then used
here.
mp3tag
- Any MP3Tag datatype can be used and will be converted into a
new ID3v2_4 datatype.public void setID3v2Tag(AbstractID3v2Tag id3v2tag)
id3v2tag
- public void setID3v2TagOnly(AbstractID3v2Tag id3v2tag)
id3v2tag
- public AbstractID3v2Tag getID3v2Tag()
ID3v2
tag for this datatype.
ID3v2
tag for this datatypepublic ID3v24Tag getID3v2TagAsv24()
public void delete(AbstractTag mp3tag) throws java.io.FileNotFoundException, java.io.IOException
mp3tag
-
java.io.FileNotFoundException
java.io.IOException
public void save() throws java.io.IOException, TagException
java.io.IOException
- on any I/O error
TagException
- on any exception generated by this library.public void commit() throws CannotWriteException
commit
in class AudioFile
CannotWriteException
AudioFileIO
public void precheck(java.io.File file) throws java.io.IOException
file
-
java.io.IOException
public void save(java.io.File file) throws java.io.IOException
file
- file to save the this datatype's tags to
java.io.FileNotFoundException
- if unable to find file
java.io.IOException
- on any I/O errorpublic java.lang.String displayStructureAsXML()
displayStructureAsXML
in class AudioFile
public java.lang.String displayStructureAsPlainText()
displayStructureAsPlainText
in class AudioFile
private static void createXMLStructureFormatter()
private static void createPlainTextStructureFormatter()
public static AbstractTagDisplayFormatter getStructureFormatter()
public void setTag(Tag tag)
setTag
in class AudioFile
tag
- public Tag createDefaultTag()
createDefaultTag
in class AudioFile
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |