jautil.avatar
Class AvatarData

java.lang.Object
  extended by jautil.avatar.AvatarData

public final class AvatarData
extends java.lang.Object

Holds all the essential data for a particular instance of a JARP avatar, including its name and base URL. An instance of this class can be constructed in one of two ways: by reading the appropriate files under a given base URL, or by reading them as resources relative to a so-called access class. In the latter case the access class and the resource files will typically be packaged in a JAR file for which a class loader has previously been established.


Field Summary
 java.lang.Class ACCESS_CLASS
          The access class for the avatar data files, if it has one.
static int ASD_IX
           
 byte[] ASD_XML
          The data in the avatar's ASD XML file (asd.xml).
 java.lang.String AVATAR
          The avatar name.
 byte[] AVATAR_DEF
          The data in the ARP avatar definition file for this avatar (avatardef.jarp or avatardef.jarp).
 java.lang.String AVATAR_DEF_NAME
          The name of the avatar definition file.
 java.lang.String AVATAR_DEF_URL
          The full URL for the avatar definition file.
 java.lang.String BASE_URL
          The base URL for the directory containing the avatar data files, if it has one.
static int CONFIG_IX
           
 byte[] CONFIG_XML
          The data in the avatar's animgen configuration data XML file (config.xml).
static int NONMANUALS_IX
           
 byte[] NONMANUALS_XML
          The data in the avatar's nonmanuals XML file (nonmanuals.xml).
static java.lang.String[] XML_NAMES
          Names of an avatar's XML data files.
 
Constructor Summary
AvatarData(java.lang.String av, java.lang.Class access)
          Constructs a new avatar data record for the avatar with the given name and access class.
AvatarData(java.lang.String av, java.lang.String burl)
          Constructs a new avatar data record for the avatar with the given name and data at the given base URL.
 
Method Summary
 byte[] getData(java.lang.String rname)
          Loads and returns the data from the specified resource for this avatar.
static byte[] getFileDataAtBase(java.lang.String fname, java.lang.String baseurl, java.lang.String btag)
          Loads and returns the given file under the given avatar base URL, using the given base description tag in any download progress dialog, if one is used.
static byte[] getResourceData(java.lang.Class access, java.lang.String rname)
          Loads and returns the data from the given resource from the same package/folder as the given access class.
 boolean isAllAvailable()
          Indicates whether or not all the avatar data files (ASD, animgen config, nonmanuals, ARP avatar def.) were successfully loaded.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

XML_NAMES

public static final java.lang.String[] XML_NAMES
Names of an avatar's XML data files.


ASD_IX

public static final int ASD_IX
See Also:
Constant Field Values

CONFIG_IX

public static final int CONFIG_IX
See Also:
Constant Field Values

NONMANUALS_IX

public static final int NONMANUALS_IX
See Also:
Constant Field Values

AVATAR

public final java.lang.String AVATAR
The avatar name.


BASE_URL

public final java.lang.String BASE_URL
The base URL for the directory containing the avatar data files, if it has one.


ACCESS_CLASS

public final java.lang.Class ACCESS_CLASS
The access class for the avatar data files, if it has one.


AVATAR_DEF_URL

public final java.lang.String AVATAR_DEF_URL
The full URL for the avatar definition file.


AVATAR_DEF_NAME

public final java.lang.String AVATAR_DEF_NAME
The name of the avatar definition file.


ASD_XML

public final byte[] ASD_XML
The data in the avatar's ASD XML file (asd.xml).


CONFIG_XML

public final byte[] CONFIG_XML
The data in the avatar's animgen configuration data XML file (config.xml).


NONMANUALS_XML

public final byte[] NONMANUALS_XML
The data in the avatar's nonmanuals XML file (nonmanuals.xml).


AVATAR_DEF

public final byte[] AVATAR_DEF
The data in the ARP avatar definition file for this avatar (avatardef.jarp or avatardef.jarp).

Constructor Detail

AvatarData

public AvatarData(java.lang.String av,
                  java.lang.String burl)
Constructs a new avatar data record for the avatar with the given name and data at the given base URL.


AvatarData

public AvatarData(java.lang.String av,
                  java.lang.Class access)
Constructs a new avatar data record for the avatar with the given name and access class.

Method Detail

isAllAvailable

public boolean isAllAvailable()
Indicates whether or not all the avatar data files (ASD, animgen config, nonmanuals, ARP avatar def.) were successfully loaded.


getData

public byte[] getData(java.lang.String rname)
Loads and returns the data from the specified resource for this avatar.


getFileDataAtBase

public static byte[] getFileDataAtBase(java.lang.String fname,
                                       java.lang.String baseurl,
                                       java.lang.String btag)
Loads and returns the given file under the given avatar base URL, using the given base description tag in any download progress dialog, if one is used.


getResourceData

public static byte[] getResourceData(java.lang.Class access,
                                     java.lang.String rname)
Loads and returns the data from the given resource from the same package/folder as the given access class.