Holger's Java API

## com.antelmann.cddb
Interface CDDB

All Known Implementing Classes:
  FileCDDB, FreeDB, SQLCDDB

    public interface CDDB

The interface CDDB specifies the methods that a CD database needs to provide to serve as a database in this framework.

These methods include ways to query, retrieve and store information for a CD.

Obviously, any implementations - particularly local database applications - may provide many more features, like sorted inventory listings, flexible queries, etc. This interface just provides the bare necessities to serve as a CDDB.
Even implementations of remote public CDDB services can provide additional information, such as a listing of their mirror sites or the alike (see FreeDB for a reference implementation).

In regards to exception handling, you may want to keep in mind that many of the implementing classes may actually throw a CDDBProtocolException rather than an IOException (which is its super class), which may provide you with additional information about what went wrong.

Author:
  Holger Antelmann
See Also:
  `FreeDB`, `CDID`, `CDDBRecord`, `CDInfo`, `CDDBProtocolException`

Method Summary
`String[]` `getCategories()` returns the available categories under which the CDInfo entries are stored - in accordance to the CDDB standard
`CDDBRecord[]` `queryCD(CDID cd)` queries the database and returns an array of matches.
`CDInfo` `readCDInfo(CDDBRecord record)` reads the information for the specified record from the database and returns it in form of a CDInfo object.
`void` `writeCDInfo(CDInfo cdinfo)` allows to submit CD information to the database - if the operation is permitted by the database.

Method Detail

### getCategories

    String[] getCategories()
                           throws IOException,
                                  CDDBProtocolException

  returns the available categories under which the CDInfo entries are stored - in accordance to the CDDB standard

  Throws:
    `IOException`
    `CDDBProtocolException`

### queryCD

    CDDBRecord[] queryCD(CDID cd)
                         throws IOException,
                                CDDBProtocolException

  queries the database and returns an array of matches. These matches can be exact matches as well as inexact matches, which can be determined by calling `isExactMatch()` on any returned element.

  Throws:
    `IOException`
    `CDDBProtocolException`
  See Also:
    `CDDBRecord.isExactMatch()`

### readCDInfo

    CDInfo readCDInfo(CDDBRecord record)
                      throws IOException,
                             CDDBProtocolException

  reads the information for the specified record from the database and returns it in form of a CDInfo object. The record should be derived from a previous query.

  Throws:
    `IOException`
    `CDDBProtocolException`
  See Also:
    `queryCD(CDID)`

### writeCDInfo

    void writeCDInfo(CDInfo cdinfo)
                     throws IOException,
                            CDDBProtocolException

  allows to submit CD information to the database - if the operation is permitted by the database. In the case that the operation is not allowed by the server, a CDDBProtocolException may be thrown.

  Throws:
    `IOException`
    `CDDBProtocolException`

(c) Holger Antelmann since 2001- all rights reserved (contact: info@antelmann.com)
see www.antelmann.com/developer for further details and available downloads