|
Holger's Java API |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.antelmann.cddb.FileCDDB
public class FileCDDB
FileCDDB is a local CD database that works off the file system.
The format under which the CD entries are stored is identical to
the raw format of the online FreeDB.org service:
Each category is represented by a subdirectory from the base directory,
and each CDinfo object is stored in a separate file named by the discID
in the associated category.
For 'fuzzy' (or inexact) queries, the FileCDDB incorporates a FuzzyLookup table that - by convention of this implementation - is based on a file that resides in the base directory of the database and is named fuzzy.map
FuzzyLookup,
FreeDB,
CDInfo,
CDID.getDiscID()| Field Summary | |
|---|---|
static String |
FUZZY_MAP
location of the FuzzyLookup file relative to the base dir |
| Constructor Summary | |
|---|---|
FileCDDB()
uses cddb.local.dir from Settings.getProperty(String)
to determine the default directory |
|
FileCDDB(File directory)
uses the given directory as the basis for the file-based database |
|
| Method Summary | |
|---|---|
MyFile |
getBaseDirectory()
returns the directory it uses to store/retrieve CD info |
String[] |
getCategories()
returns the available categories under which the CDInfo entries are stored - in accordance to the CDDB standard |
MyFile |
getFileHandle(CDDBRecord record)
returns the file handle corresponding to the given record (this file would contain the information read to construct the CDInfo object) |
int |
importCDInfoFromServer(CDID cd,
CDDB server)
imports all information that can be retrieved from the CDDB server in regards to the given CD (including fuzzy matches). |
boolean |
isInDatabase(CDID cd)
returns true only if at least one matching valid CDInfo instance is available in the database |
CDDBRecord[] |
queryCD(CDID cd)
queries the database and returns an array of matches. |
CDInfo |
readCDInfo(CDDBRecord record)
returns a CDDBEntry instance |
CDDBRecord[] |
search(String pattern)
performs a full-text search on the database |
protected void |
storeFuzzyMatch(CDID cd,
CDDBRecord[] similarEntries)
stores the given fuzzy matches in the embedded FuzzyLookup instance. |
int |
verifyDB()
verifies the entire content of the database and returns the number of available CDInfo instances if everything went smoothly. |
void |
writeCDInfo(CDInfo cdinfo)
Writes the given CDInfo object to a file as specified in the raw CDDB format. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final String FUZZY_MAP
| Constructor Detail |
|---|
public FileCDDB()
throws IOException
Settings.getProperty(String)
to determine the default directory
IOExceptionSettings.getProperty(String)
public FileCDDB(File directory)
throws IOException
IOException| Method Detail |
|---|
public MyFile getBaseDirectory()
public String[] getCategories()
CDDB
getCategories in interface CDDB
public CDInfo readCDInfo(CDDBRecord record)
throws IOException,
CDDBProtocolException
readCDInfo in interface CDDBIOException
CDDBProtocolExceptionCDDBEntrypublic MyFile getFileHandle(CDDBRecord record)
readCDInfo(CDDBRecord)
public void writeCDInfo(CDInfo cdinfo)
throws IOException
writeCDInfo in interface CDDBIOException - among other reasons if the file entry already existsCDInfo.getXmcdContent()
public CDDBRecord[] queryCD(CDID cd)
throws IOException,
CDDBProtocolException
CDDBisExactMatch()
on any returned element.
queryCD in interface CDDBIOException
CDDBProtocolExceptionCDDBRecord.isExactMatch()
public boolean isInDatabase(CDID cd)
throws IOException,
CDDBProtocolException
IOException
CDDBProtocolException
public int importCDInfoFromServer(CDID cd,
CDDB server)
throws IOException,
CDDBProtocolException
IOException
CDDBProtocolException
protected void storeFuzzyMatch(CDID cd,
CDDBRecord[] similarEntries)
throws IOException
IOExceptionimportCDInfoFromServer(CDID, CDDB)
public int verifyDB()
throws IOException,
XmcdFormatException
IOException - if a file could not be read
XmcdFormatException - if a file could not be properly parsed
public CDDBRecord[] search(String pattern)
throws IOException
IOException
|
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||