net.anidb.udp
Class UdpFileFactory

java.lang.Object
  extended by net.anidb.udp.UdpFileFactory

public class UdpFileFactory
extends java.lang.Object

A factory for File objects.

Version:
1.0, 25.12.2009
Author:
grizzlyxp (http://anidb.net/perl-bin/animedb.pl?show=userpage&uid=63935)

Method Summary
 File getFile(long fileId, FileMask fileMask, AnimeFileMask animeFileMask)
          Returns the file with the given Id.
 java.util.List<File> getFiles(long animeId, long groupId, long episodeNumber, FileMask fileMask, AnimeFileMask animeFileMask)
          Returns the files with the given anime Id, group Id and episode number.
 java.util.List<File> getFiles(long size, java.lang.String ed2kHash, FileMask fileMask, AnimeFileMask animeFileMask)
          Returns the files with the given size and ed2k hash.
 java.util.List<File> getFiles(long animeId, java.lang.String groupName, long episodeNumber, FileMask fileMask, AnimeFileMask animeFileMask)
          Returns the files with the given anime Id, group name and episode number.
 java.util.List<File> getFiles(java.lang.String animeName, long groupId, long episodeNumber, FileMask fileMask, AnimeFileMask animeFileMask)
          Returns the files with the given anime name, group Id and episode number.
 java.util.List<File> getFiles(java.lang.String animeName, java.lang.String groupName, long episodeNumber, FileMask fileMask, AnimeFileMask animeFileMask)
          Returns the files with the given anime name, group name and episode number.
static UdpFileFactory getInstance(UdpConnection conn)
          Returns an instance of this class.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static UdpFileFactory getInstance(UdpConnection conn)
Returns an instance of this class.

Parameters:
conn - The connection.
Returns:
The instance.
Throws:
java.lang.IllegalArgumentException - If the connection is null.

getFile

public File getFile(long fileId,
                    FileMask fileMask,
                    AnimeFileMask animeFileMask)
             throws UdpConnectionException,
                    AniDbException

Returns the file with the given Id.

Only the fields specified by the two masks will be filled.

Parameters:
fileId - The file Id.
fileMask - The file mask.
animeFileMask - The anime file mask.
Returns:
The file.
Throws:
java.lang.IllegalArgumentException - If the file mask is null.
java.lang.IllegalArgumentException - If the anime file mask is null.
UdpConnectionException - If a connection problem occured.
AniDbException - If a problem with AniDB occured.
See Also:
UdpReturnCodes.NO_SUCH_FILE

getFiles

public java.util.List<File> getFiles(long size,
                                     java.lang.String ed2kHash,
                                     FileMask fileMask,
                                     AnimeFileMask animeFileMask)
                              throws UdpConnectionException,
                                     AniDbException

Returns the files with the given size and ed2k hash.

Only the fields specified by the two masks will be filled.

Parameters:
size - The size.
ed2kHash - The ed2k hash.
fileMask - The file mask.
animeFileMask - The anime file mask.
Returns:
The files.
Throws:
java.lang.IllegalArgumentException - If the size is less than 1.
java.lang.IllegalArgumentException - If the ed2k hash is null.
java.lang.IllegalArgumentException - If the file mask is null.
java.lang.IllegalArgumentException - If the anime file mask is null.
UdpConnectionException - If a connection problem occured.
AniDbException - If a problem with AniDB occured.
See Also:
UdpReturnCodes.NO_SUCH_FILE

getFiles

public java.util.List<File> getFiles(java.lang.String animeName,
                                     java.lang.String groupName,
                                     long episodeNumber,
                                     FileMask fileMask,
                                     AnimeFileMask animeFileMask)
                              throws UdpConnectionException,
                                     AniDbException

Returns the files with the given anime name, group name and episode number.

Only the fields specified by the two masks will be filled.

Parameters:
animeName - The anime name.
groupName - The group name.
episodeNumber - The episode number.
fileMask - The file mask.
animeFileMask - The anime file mask.
Returns:
The files.
Throws:
java.lang.IllegalArgumentException - If the anime name is null.
java.lang.IllegalArgumentException - If the group name is null.
java.lang.IllegalArgumentException - If the file mask is null.
java.lang.IllegalArgumentException - If the anime file mask is null.
UdpConnectionException - If a connection problem occured.
AniDbException - If a problem with AniDB occured.
See Also:
UdpReturnCodes.NO_SUCH_FILE

getFiles

public java.util.List<File> getFiles(java.lang.String animeName,
                                     long groupId,
                                     long episodeNumber,
                                     FileMask fileMask,
                                     AnimeFileMask animeFileMask)
                              throws UdpConnectionException,
                                     AniDbException

Returns the files with the given anime name, group Id and episode number.

Only the fields specified by the two masks will be filled.

Parameters:
animeName - The anime name.
groupId - The group Id.
episodeNumber - The episode number.
fileMask - The file mask.
animeFileMask - The anime file mask.
Returns:
The files.
Throws:
java.lang.IllegalArgumentException - If the anime name is null.
java.lang.IllegalArgumentException - If the file mask is null.
java.lang.IllegalArgumentException - If the anime file mask is null.
UdpConnectionException - If a connection problem occured.
AniDbException - If a problem with AniDB occured.
See Also:
UdpReturnCodes.NO_SUCH_FILE

getFiles

public java.util.List<File> getFiles(long animeId,
                                     java.lang.String groupName,
                                     long episodeNumber,
                                     FileMask fileMask,
                                     AnimeFileMask animeFileMask)
                              throws UdpConnectionException,
                                     AniDbException

Returns the files with the given anime Id, group name and episode number.

Only the fields specified by the two masks will be filled.

Parameters:
animeId - The anime Id.
groupName - The group name.
episodeNumber - The episode number.
fileMask - The file mask.
animeFileMask - The anime file mask.
Returns:
The files.
Throws:
java.lang.IllegalArgumentException - If the group name is null.
java.lang.IllegalArgumentException - If the file mask is null.
java.lang.IllegalArgumentException - If the anime file mask is null.
UdpConnectionException - If a connection problem occured.
AniDbException - If a problem with AniDB occured.
See Also:
UdpReturnCodes.NO_SUCH_FILE

getFiles

public java.util.List<File> getFiles(long animeId,
                                     long groupId,
                                     long episodeNumber,
                                     FileMask fileMask,
                                     AnimeFileMask animeFileMask)
                              throws UdpConnectionException,
                                     AniDbException

Returns the files with the given anime Id, group Id and episode number.

Only the fields specified by the two masks will be filled.

Parameters:
animeId - The anime Id.
groupId - The group Id.
episodeNumber - The episode number.
fileMask - The file mask.
animeFileMask - The anime file mask.
Returns:
The files.
Throws:
java.lang.IllegalArgumentException - If the file mask is null.
java.lang.IllegalArgumentException - If the anime file mask is null.
UdpConnectionException - If a connection problem occured.
AniDbException - If a problem with AniDB occured.
See Also:
UdpReturnCodes.NO_SUCH_FILE