net.shredzone.ifish.db
Class Entry

java.lang.Object
  extended by net.shredzone.ifish.db.Entry
All Implemented Interfaces:
Serializable, Comparable<Entry>
Direct Known Subclasses:
DbEntry, FileEntry

public abstract class Entry
extends Object
implements Serializable, Comparable<Entry>

Abstract class for an entry in the iRiver database.

Version:
$Id: Entry.java 291 2009-04-28 21:29:27Z shred $
See Also:
Serialized Form

Constructor Summary
Entry()
           
 
Method Summary
 int compareTo(Entry o)
          Compare one Entry to another.
 boolean equals(Object o)
          Check if this Entry is equal to another object.
abstract  String getAlbum()
          Get the album of the track, as given by the file's tag.
abstract  String getArtist()
          Get the artist of the track, as given by the file's tag.
protected  byte[] getBytesTerm(String str, String charset)
          Get a byte array of a string, using the given charset.
 File getFile()
          Get the file behind this entry.
abstract  String getFileName()
          Get the file name of this entry.
abstract  String getGenre()
          Get the genre of the track, as given by the file's tag.
abstract  String getTitle()
          Get the title of the track, as given by the file's tag.
 int hashCode()
          Return a hash code for this Entry.
 int size(String charset)
          Get the byte size of this entry when saved to the database
 void write(OutputStream out, String charset)
          Write the entry to an OutputStream in iRivDB format.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Entry

public Entry()
Method Detail

getFile

public File getFile()
Get the file behind this entry. Returns null if there is no matching file in the file system.

Returns:
File represented by this entry

getFileName

public abstract String getFileName()
Get the file name of this entry. This is the path and file name relative to the iHP root directory mount point, and always using wrongslashes (even on unixoid systems).

Returns:
File name

getTitle

public abstract String getTitle()
Get the title of the track, as given by the file's tag. Does not return null.

Returns:
Title

getArtist

public abstract String getArtist()
Get the artist of the track, as given by the file's tag. Does not return null.

Returns:
Artist

getAlbum

public abstract String getAlbum()
Get the album of the track, as given by the file's tag. Does not return null.

Returns:
Album

getGenre

public abstract String getGenre()
Get the genre of the track, as given by the file's tag. This is always a word, not a number. Does not return null.

Returns:
Genre

size

public int size(String charset)
         throws UnsupportedEncodingException
Get the byte size of this entry when saved to the database

Parameters:
charset - Charset the iRivNavi.db shall be written in
Returns:
Size
Throws:
UnsupportedEncodingException

write

public void write(OutputStream out,
                  String charset)
           throws IOException,
                  UnsupportedEncodingException
Write the entry to an OutputStream in iRivDB format.

Parameters:
out - OutputStream to write to
charset - Charset the iRivNavi.db shall be written in
Throws:
IOException, - UnsupportedEncodingException
IOException
UnsupportedEncodingException

getBytesTerm

protected byte[] getBytesTerm(String str,
                              String charset)
                       throws UnsupportedEncodingException
Get a byte array of a string, using the given charset. The byte array will be properly null terminated.

Parameters:
str - String to convert
charset - Charset to be used
Returns:
A byte array of the string, null terminated.
Throws:
UnsupportedEncodingException

compareTo

public int compareTo(Entry o)
Compare one Entry to another.

Specified by:
compareTo in interface Comparable<Entry>
Parameters:
o - Other Entry to compare this entry to
Returns:
positive, 0 or negative value according to the result

equals

public boolean equals(Object o)
Check if this Entry is equal to another object. An Entry is never equal to null or foreign objects. Two Entry are considered equal if they have the same file name.

Overrides:
equals in class Object
Parameters:
o - Object to compare with
Returns:
true: same, false: different

hashCode

public int hashCode()
Return a hash code for this Entry.

Overrides:
hashCode in class Object
Returns:
int Hash Code


Copyright © 2007-2011 shredzone.org. All Rights Reserved.