net.anidb.udp
Class UdpAnimeDescriptionFactory

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

public class UdpAnimeDescriptionFactory
extends java.lang.Object

A factory for anime descriptions.

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

Method Summary
 java.lang.String getAnimeDescription(long animeId)
          Returns the description for the anime with the given Id.
static UdpAnimeDescriptionFactory 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 UdpAnimeDescriptionFactory 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.

getAnimeDescription

public java.lang.String getAnimeDescription(long animeId)
                                     throws UdpConnectionException,
                                            AniDbException

Returns the description for the anime with the given Id.

It should be considered that this method has to use more than one request for retrieving the complete description. The reason is that a descrption can take up to ~5000 characters while the maximum data of an UDP packet is ~1400 bytes.

Parameters:
animeId - The anime Id.
Returns:
The description.
Throws:
UdpConnectionException - If a connection problem occured.
AniDbException - If a problem with AniDB occured.
See Also:
UdpReturnCodes.NO_SUCH_ANIME, UdpReturnCodes.NO_SUCH_ANIME_DESCRIPTION