org.farng.mp3
Class TagOptionSingleton

java.lang.Object
  extended byorg.farng.mp3.TagOptionSingleton

public class TagOptionSingleton
extends java.lang.Object

Options that are used for every object and class in this library.

Version:
$Revision: 1.3 $
Author:
Eric Farng

Method Summary
 void addEndWordDelimiter(java.lang.String wordDelimiter)
           
 void addFilenameDelimiter(java.lang.String delimiter)
           
 void addKeyword(java.lang.Class id3v2FrameBodyClass, java.lang.String keyword)
           
 void addParenthesis(java.lang.String open, java.lang.String close)
           
 void addReplaceWord(java.lang.String oldWord, java.lang.String newWord)
           
 void addStartWordDelimiter(java.lang.String wordDelimiter)
           
 void addUpperLowerCaseWord(java.lang.String word)
           
 java.lang.String getCloseParenthesis(java.lang.String open)
           
 int getDefaultSaveMode()
           
 java.util.Iterator getEndWordDelimiterIterator()
           
 java.util.Iterator getFilenameDelimiterIterator()
           
 float getId3v2PaddingMultiplier()
          Returns the factor to increase the id3v2 padding size.
 int getId3v2PaddingSize()
          Returns the initial ID3v2 padding length.
static TagOptionSingleton getInstance()
           
static TagOptionSingleton getInstance(java.lang.Object instanceKey)
           
static java.lang.Object getInstanceKey()
           
 java.util.Iterator getKeywordIterator()
           
 java.util.Iterator getKeywordListIterator(java.lang.Class id3v2_4FrameBody)
           
 java.lang.String getLanguage()
          Returns the default language for any ID3v2 tag frames which require it.
 boolean getLyrics3SaveField(java.lang.String id)
          Returns true if we should save the Lyrics3 field asked for in the argument.
 java.util.Map getLyrics3SaveFieldMap()
           
 java.lang.String getNewReplaceWord(java.lang.String oldWord)
           
 int getNumberMP3SyncFrame()
          Returns the number of MP3 frames to sync when trying to find the start of the MP3 frame data.
 java.util.Iterator getOldReplaceWordIterator()
           
 java.util.Iterator getOpenParenthesisIterator()
           
 byte getPlayCounterSize()
          Returns the default play counter size for the PCNT ID3v2 frame.
 java.util.Iterator getStartWordDelimiterIterator()
           
 byte getTextEncoding()
          Returns the default text encoding format for ID3v2 tags which require it.
 byte getTimeStampFormat()
          Returns the default time stamp format for ID3v2 tags which require it.
 java.util.Iterator getUpperLowerCaseWordListIterator()
           
 boolean isCloseParenthesis(java.lang.String close)
           
 boolean isCompositeMatchOverwrite()
           
 boolean isFilenameTagSave()
           
 boolean isId3v1Save()
           
 boolean isId3v1SaveAlbum()
           
 boolean isId3v1SaveArtist()
           
 boolean isId3v1SaveComment()
           
 boolean isId3v1SaveGenre()
           
 boolean isId3v1SaveTitle()
           
 boolean isId3v1SaveTrack()
           
 boolean isId3v1SaveYear()
           
 boolean isId3v2KeepEmptyFrameIfRead()
           
 boolean isId3v2PaddingCopyTag()
           
 boolean isId3v2PaddingWillShorten()
           
 boolean isId3v2Save()
           
 boolean isId3v2SaveEmptyFrame()
           
 boolean isId3v2SaveExtendedHeader()
           
 boolean isLyrics3KeepEmptyFieldIfRead()
           
 boolean isLyrics3Save()
           
 boolean isLyrics3SaveEmptyField()
           
 boolean isOpenParenthesis(java.lang.String open)
           
 boolean isOriginalSavedAfterAdjustingID3v2Padding()
           
 void setCompositeMatchOverwrite(boolean compositeMatchOverwrite)
           
 void setDefaultSaveMode(int defaultSaveMode)
           
 void setFilenameTagSave(boolean filenameTagSave)
           
 void setId3v1Save(boolean id3v1Save)
           
 void setId3v1SaveAlbum(boolean id3v1SaveAlbum)
           
 void setId3v1SaveArtist(boolean id3v1SaveArtist)
           
 void setId3v1SaveComment(boolean id3v1SaveComment)
           
 void setId3v1SaveGenre(boolean id3v1SaveGenre)
           
 void setId3v1SaveTitle(boolean id3v1SaveTitle)
           
 void setId3v1SaveTrack(boolean id3v1SaveTrack)
           
 void setId3v1SaveYear(boolean id3v1SaveYear)
           
 void setId3v2KeepEmptyFrameIfRead(boolean id3v2KeepEmptyFrameIfRead)
           
 void setId3v2PaddingCopyTag(boolean id3v2PaddingCopyTag)
           
 void setId3v2PaddingMultiplier(float mult)
          Sets the factor to increase the id3v2 padding size.
 void setId3v2PaddingSize(int size)
          Sets the initial ID3v2 padding length.
 void setId3v2PaddingWillShorten(boolean id3v2PaddingWillShorten)
           
 void setId3v2Save(boolean id3v2Save)
           
 void setId3v2SaveEmptyFrame(boolean id3v2SaveEmptyFrame)
           
 void setId3v2SaveExtendedHeader(boolean id3v2SaveExtendedHeader)
           
 void setInstanceKey(java.lang.Object instanceKey)
           
 void setLanguage(java.lang.String language)
          Sets the default language for any ID3v2 tag frames which require it.
 void setLyrics3KeepEmptyFieldIfRead(boolean lyrics3KeepEmptyFieldIfRead)
           
 void setLyrics3Save(boolean lyrics3Save)
           
 void setLyrics3SaveEmptyField(boolean lyrics3SaveEmptyField)
           
 void setLyrics3SaveField(java.lang.String id, boolean save)
          Sets if we should save the Lyrics3 field.
 void setNumberMP3SyncFrame(int numberMP3SyncFrame)
          Sets the number of MP3 frames to sync when trying to find the start of the MP3 frame data.
 void setOriginalSavedAfterAdjustingID3v2Padding(boolean originalSavedAfterAdjustingID3v2Padding)
           
 void setPlayCounterSize(byte size)
          Sets the default play counter size for the PCNT ID3v2 frame.
 void setTextEncoding(byte enc)
          Sets the default text encoding for any ID3v2 tag frames which require it.
 void setTimeStampFormat(byte tsf)
          Sets the default time stamp format for ID3v2 tags which require it.
 void setToDefault()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static TagOptionSingleton getInstance()

getInstance

public static TagOptionSingleton getInstance(java.lang.Object instanceKey)

getCloseParenthesis

public java.lang.String getCloseParenthesis(java.lang.String open)

isCloseParenthesis

public boolean isCloseParenthesis(java.lang.String close)

setCompositeMatchOverwrite

public void setCompositeMatchOverwrite(boolean compositeMatchOverwrite)

isCompositeMatchOverwrite

public boolean isCompositeMatchOverwrite()

setDefaultSaveMode

public void setDefaultSaveMode(int defaultSaveMode)

getDefaultSaveMode

public int getDefaultSaveMode()

setFilenameTagSave

public void setFilenameTagSave(boolean filenameTagSave)

isFilenameTagSave

public boolean isFilenameTagSave()

isId3v2SaveExtendedHeader

public boolean isId3v2SaveExtendedHeader()

setInstanceKey

public void setInstanceKey(java.lang.Object instanceKey)

getInstanceKey

public static java.lang.Object getInstanceKey()

getEndWordDelimiterIterator

public java.util.Iterator getEndWordDelimiterIterator()

getFilenameDelimiterIterator

public java.util.Iterator getFilenameDelimiterIterator()

setId3v1Save

public void setId3v1Save(boolean id3v1Save)

isId3v1Save

public boolean isId3v1Save()

setId3v1SaveAlbum

public void setId3v1SaveAlbum(boolean id3v1SaveAlbum)

isId3v1SaveAlbum

public boolean isId3v1SaveAlbum()

setId3v1SaveArtist

public void setId3v1SaveArtist(boolean id3v1SaveArtist)

isId3v1SaveArtist

public boolean isId3v1SaveArtist()

setId3v1SaveComment

public void setId3v1SaveComment(boolean id3v1SaveComment)

isId3v1SaveComment

public boolean isId3v1SaveComment()

setId3v1SaveGenre

public void setId3v1SaveGenre(boolean id3v1SaveGenre)

isId3v1SaveGenre

public boolean isId3v1SaveGenre()

setId3v1SaveTitle

public void setId3v1SaveTitle(boolean id3v1SaveTitle)

isId3v1SaveTitle

public boolean isId3v1SaveTitle()

setId3v1SaveTrack

public void setId3v1SaveTrack(boolean id3v1SaveTrack)

isId3v1SaveTrack

public boolean isId3v1SaveTrack()

setId3v1SaveYear

public void setId3v1SaveYear(boolean id3v1SaveYear)

isId3v1SaveYear

public boolean isId3v1SaveYear()

setId3v2KeepEmptyFrameIfRead

public void setId3v2KeepEmptyFrameIfRead(boolean id3v2KeepEmptyFrameIfRead)

isId3v2KeepEmptyFrameIfRead

public boolean isId3v2KeepEmptyFrameIfRead()

setId3v2PaddingCopyTag

public void setId3v2PaddingCopyTag(boolean id3v2PaddingCopyTag)

isId3v2PaddingCopyTag

public boolean isId3v2PaddingCopyTag()

setId3v2PaddingMultiplier

public void setId3v2PaddingMultiplier(float mult)
Sets the factor to increase the id3v2 padding size. When the ID3v2 tag padding length is calculated and is not large enough to fit the current ID3v2 tag, the padding length will be multiplied by this number until it is large enough.

Parameters:
mult - new factor to increase the id3v2 padding size.

getId3v2PaddingMultiplier

public float getId3v2PaddingMultiplier()
Returns the factor to increase the id3v2 padding size. When the ID3v2 tag padding length is calculated and is not large enough to fit the current ID3v2 tag, the padding length will be multiplied by this number until it is large enough.

Returns:
the factor to increase the id3v2 padding size

setId3v2PaddingSize

public void setId3v2PaddingSize(int size)
Sets the initial ID3v2 padding length. This will be the minimum padding length of the ID3v2 tag. The willShorten setting will not make the length shorter than this value.

Parameters:
size - the new initial ID3v2 padding length

getId3v2PaddingSize

public int getId3v2PaddingSize()
Returns the initial ID3v2 padding length. This will be the minimum padding length of the ID3v2 tag. The willShorten setting will not make the length shorter than this value.

Returns:
the initial ID3v2 padding length

setId3v2PaddingWillShorten

public void setId3v2PaddingWillShorten(boolean id3v2PaddingWillShorten)

isId3v2PaddingWillShorten

public boolean isId3v2PaddingWillShorten()

setId3v2Save

public void setId3v2Save(boolean id3v2Save)

isId3v2Save

public boolean isId3v2Save()

setId3v2SaveEmptyFrame

public void setId3v2SaveEmptyFrame(boolean id3v2SaveEmptyFrame)

isId3v2SaveEmptyFrame

public boolean isId3v2SaveEmptyFrame()

setId3v2SaveExtendedHeader

public void setId3v2SaveExtendedHeader(boolean id3v2SaveExtendedHeader)

getKeywordIterator

public java.util.Iterator getKeywordIterator()

getKeywordListIterator

public java.util.Iterator getKeywordListIterator(java.lang.Class id3v2_4FrameBody)

setLanguage

public void setLanguage(java.lang.String language)
Sets the default language for any ID3v2 tag frames which require it. While the value will already exist when reading from a file, this value will be used when a new ID3v2 Frame is created from scratch.

Parameters:
language - language ID, [ISO-639-2] ISO/FDIS 639-2 definition

getLanguage

public java.lang.String getLanguage()
Returns the default language for any ID3v2 tag frames which require it.

Returns:
language ID, [ISO-639-2] ISO/FDIS 639-2 definition

setLyrics3KeepEmptyFieldIfRead

public void setLyrics3KeepEmptyFieldIfRead(boolean lyrics3KeepEmptyFieldIfRead)

isLyrics3KeepEmptyFieldIfRead

public boolean isLyrics3KeepEmptyFieldIfRead()

setLyrics3Save

public void setLyrics3Save(boolean lyrics3Save)

isLyrics3Save

public boolean isLyrics3Save()

setLyrics3SaveEmptyField

public void setLyrics3SaveEmptyField(boolean lyrics3SaveEmptyField)

isLyrics3SaveEmptyField

public boolean isLyrics3SaveEmptyField()

setLyrics3SaveField

public void setLyrics3SaveField(java.lang.String id,
                                boolean save)
Sets if we should save the Lyrics3 field. Defaults to true.

Parameters:
id - Lyrics3 id string
save - true if you want to save this specific Lyrics3 field.

getLyrics3SaveField

public boolean getLyrics3SaveField(java.lang.String id)
Returns true if we should save the Lyrics3 field asked for in the argument. Defaults to true.

Parameters:
id - Lyrics3 id string
Returns:
true if we should save the Lyrics3 field.

getLyrics3SaveFieldMap

public java.util.Map getLyrics3SaveFieldMap()

getNewReplaceWord

public java.lang.String getNewReplaceWord(java.lang.String oldWord)

setNumberMP3SyncFrame

public void setNumberMP3SyncFrame(int numberMP3SyncFrame)
Sets the number of MP3 frames to sync when trying to find the start of the MP3 frame data. The start of the MP3 frame data is the start of the music and is different from the ID3v2 frame data. WinAmp 2.8 seems to sync 3 frames. Default is 5.

Parameters:
numberMP3SyncFrame - number of MP3 frames to sync

getNumberMP3SyncFrame

public int getNumberMP3SyncFrame()
Returns the number of MP3 frames to sync when trying to find the start of the MP3 frame data. The start of the MP3 frame data is the start of the music and is different from the ID3v2 frame data. WinAmp 2.8 seems to sync 3 frames. Default is 5.

Returns:
number of MP3 frames to sync

getOldReplaceWordIterator

public java.util.Iterator getOldReplaceWordIterator()

isOpenParenthesis

public boolean isOpenParenthesis(java.lang.String open)

getOpenParenthesisIterator

public java.util.Iterator getOpenParenthesisIterator()

setOriginalSavedAfterAdjustingID3v2Padding

public void setOriginalSavedAfterAdjustingID3v2Padding(boolean originalSavedAfterAdjustingID3v2Padding)

isOriginalSavedAfterAdjustingID3v2Padding

public boolean isOriginalSavedAfterAdjustingID3v2Padding()

setPlayCounterSize

public void setPlayCounterSize(byte size)
Sets the default play counter size for the PCNT ID3v2 frame. While the value will already exist when reading from a file, this value will be used when a new ID3v2 Frame is created from scratch.

Parameters:
size - the default play counter size for the PCNT ID3v2 frame

getPlayCounterSize

public byte getPlayCounterSize()
Returns the default play counter size for the PCNT ID3v2 frame.

Returns:
the default play counter size for the PCNT ID3v2 frame

getStartWordDelimiterIterator

public java.util.Iterator getStartWordDelimiterIterator()

setTextEncoding

public void setTextEncoding(byte enc)
Sets the default text encoding for any ID3v2 tag frames which require it. While the value will already exist when reading from a file, this value will be used when a new ID3v2 Frame is created from scratch.

$00 ISO-8859-1 [ISO-8859-1]. Terminated with $00.
$01 UTF-16 [UTF-16] encoded Unicode [UNICODE] with BOM. All strings in the same frame SHALL have the same byteorder. Terminated with $00 00.
$02 UTF-16BE [UTF-16] encoded Unicode [UNICODE] without BOM. Terminated with $00 00.
$03 UTF-8 [UTF-8] encoded Unicode [UNICODE]. Terminated with $00.

Parameters:
enc - new default text encoding

getTextEncoding

public byte getTextEncoding()
Returns the default text encoding format for ID3v2 tags which require it.

$00 ISO-8859-1 [ISO-8859-1]. Terminated with $00.
$01 UTF-16 [UTF-16] encoded Unicode [UNICODE] with BOM. All strings in the same frame SHALL have the same byteorder. Terminated with $00 00.
$02 UTF-16BE [UTF-16] encoded Unicode [UNICODE] without BOM. Terminated with $00 00.
$03 UTF-8 [UTF-8] encoded Unicode [UNICODE]. Terminated with $00.

Returns:
the default text encoding

setTimeStampFormat

public void setTimeStampFormat(byte tsf)
Sets the default time stamp format for ID3v2 tags which require it. While the value will already exist when reading from a file, this value will be used when a new ID3v2 Frame is created from scratch.

$01 Absolute time, 32 bit sized, using MPEG frames as unit
$02 Absolute time, 32 bit sized, using milliseconds as unit

Parameters:
tsf - the new default time stamp format

getTimeStampFormat

public byte getTimeStampFormat()
Returns the default time stamp format for ID3v2 tags which require it.

$01 Absolute time, 32 bit sized, using MPEG frames as unit
$02 Absolute time, 32 bit sized, using milliseconds as unit

Returns:
the default time stamp format

setToDefault

public void setToDefault()

getUpperLowerCaseWordListIterator

public java.util.Iterator getUpperLowerCaseWordListIterator()

addEndWordDelimiter

public void addEndWordDelimiter(java.lang.String wordDelimiter)

addFilenameDelimiter

public void addFilenameDelimiter(java.lang.String delimiter)

addKeyword

public void addKeyword(java.lang.Class id3v2FrameBodyClass,
                       java.lang.String keyword)
                throws TagException
Throws:
TagException

addParenthesis

public void addParenthesis(java.lang.String open,
                           java.lang.String close)

addReplaceWord

public void addReplaceWord(java.lang.String oldWord,
                           java.lang.String newWord)

addStartWordDelimiter

public void addStartWordDelimiter(java.lang.String wordDelimiter)

addUpperLowerCaseWord

public void addUpperLowerCaseWord(java.lang.String word)


Copyright (c) 2004 Eric Farng