Holger's
Java API

com.antelmann.cddb
Class CDSet

java.lang.Object
  extended by java.util.AbstractCollection<E>
      extended by java.util.AbstractSet<E>
          extended by java.util.HashSet<CDID>
              extended by com.antelmann.cddb.CDSet
All Implemented Interfaces:
Serializable, Cloneable, Iterable<CDID>, Collection<CDID>, Set<CDID>

public class CDSet
extends HashSet<CDID>

A helper class to manage a CD collection with the ability to import/export the set to/from a file.

The elements of this set need are to be exclusively CDID instances.

This class does not support customized user annotations; for that purpose, simply wrap this class into whatever you like to add additional information (e.g. including how many instances of the same CD are in your collection, as this class is a set). This is just a raw set of unique CDs. You may consider using a CDCollection.

This class is not thread-save nor synchronized.

Author:
Holger Antelmann
See Also:
CDID, CDCollection, Serialized Form

Constructor Summary
CDSet()
           
 
Method Summary
 void exportToFile(File file)
          exports all CDID entries into a file.
 void importFromFile(File file)
          imports CDID entries from a file; each entry is added to the current set (if not already present)
 
Methods inherited from class java.util.HashSet
add, clear, clone, contains, isEmpty, iterator, remove, size
 
Methods inherited from class java.util.AbstractSet
equals, hashCode, removeAll
 
Methods inherited from class java.util.AbstractCollection
addAll, containsAll, retainAll, toArray, toArray, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Set
addAll, containsAll, equals, hashCode, removeAll, retainAll, toArray, toArray
 

Constructor Detail

CDSet

public CDSet()
Method Detail

importFromFile

public void importFromFile(File file)
                    throws IOException
imports CDID entries from a file; each entry is added to the current set (if not already present)

Throws:
IOException
See Also:
exportToFile(File)

exportToFile

public void exportToFile(File file)
                  throws IOException
exports all CDID entries into a file. The CDID entries are represented as separate lines ('\n' terminated), while each line contains the query string from the CDID. An existing file at the specified location will be overwritten if the file attributes permit this.

Throws:
IOException
See Also:
CDID.getQueryString()


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