net.shredzone.ifish.db
Class FileEntry

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

public class FileEntry
extends Entry
implements Serializable

This class represents an Entry which was read from the file system.

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

Constructor Summary
FileEntry(File base, File file, net.shredzone.ifish.ltr.LTR ltr)
          Create a new entry from a file.
FileEntry(File base, File file, net.shredzone.ifish.ltr.LTRFactory factory)
          Create a new entry from a file.
 
Method Summary
 String getAlbum()
          Get the album of the track, as given by the file's tag.
 String getArtist()
          Get the artist of the track, as given by the file's tag.
 String getComment()
          Get the comment of the track, as given by the file's tag.
 File getFile()
          Get the file behind this entry.
 String getFileName()
          Get the file name of this entry.
 String getGenre()
          Get the genre of the track, as given by the file's tag.
 String getTitle()
          Get the title of the track, as given by the file's tag.
static boolean isDirNameFitting(File base, File file)
          Checks if the directory part of the given file would fit into this entry.
static boolean isFileNameFitting(File base, File file)
          Checks if the filename part of the given file would fit into this entry.
 
Methods inherited from class net.shredzone.ifish.db.Entry
compareTo, equals, getBytesTerm, hashCode, size, write
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FileEntry

public FileEntry(File base,
                 File file,
                 net.shredzone.ifish.ltr.LTRFactory factory)
          throws IOException,
                 DatabaseException
Create a new entry from a file. An exception is thrown if the directory or file name lengths will exceed the limit set by the iHP database. You can use isFileNameFitting() and isDirNameFitting() to pre-examine if the lenghts would be exceeded.

A LTR instance will automatically be created about the file here.

Parameters:
base - Base directory (the jukebox mount point)
file - File name to create an Entry for
factory - LTRFactory to be used
Throws:
IOException
DatabaseException

FileEntry

public FileEntry(File base,
                 File file,
                 net.shredzone.ifish.ltr.LTR ltr)
          throws IOException,
                 DatabaseException
Create a new entry from a file. An exception is thrown if the directory or file name lengths will exceed the limit set by the iHP database. You can use isFileNameFitting() and isDirNameFitting() to pre-examine if the lenghts would be exceeded.

A LTR object must be passed that describes the music tag. An exception will be thrown if ltr is null.

Parameters:
base - Base directory (the jukebox mount point)
file - File name to create an Entry for
ltr - LTR about the file contents
Throws:
IOException
DatabaseException
Method Detail

isFileNameFitting

public static boolean isFileNameFitting(File base,
                                        File file)
Checks if the filename part of the given file would fit into this entry. The iHP database only allows up to 52 characters for each the directory and the file part.

Parameters:
base - Base Directory
file - File to be checked
Returns:
true: fits, false: won't fit.

isDirNameFitting

public static boolean isDirNameFitting(File base,
                                       File file)
Checks if the directory part of the given file would fit into this entry. The iHP database only allows up to 52 characters for each part of the directory and the file part.

Parameters:
base - Base Directory
file - File to be checked
Returns:
true: fits, false: won't fit.

getFile

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

Overrides:
getFile in class Entry
Returns:
File represented by this entry

getFileName

public 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).

Specified by:
getFileName in class Entry
Returns:
File name

getTitle

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

Specified by:
getTitle in class Entry
Returns:
Title

getArtist

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

Specified by:
getArtist in class Entry
Returns:
Artist

getAlbum

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

Specified by:
getAlbum in class Entry
Returns:
Album

getGenre

public 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.

Specified by:
getGenre in class Entry
Returns:
Genre

getComment

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

Returns:
Comment


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