Class UserAccount

java.lang.Object
  |
  +--UserAccount
All Implemented Interfaces:
Storable

public class UserAccount
extends java.lang.Object
implements Storable

This class contains the information needed to identify a user account on a particular host.


Constructor Summary
UserAccount()
          Construct a new UserAccount object with empty Strings for all of the fields.
UserAccount(java.lang.String label, java.lang.String host, java.lang.String username, java.lang.String password)
          Construct a new UserAccount object using the supplied strings.
 
Method Summary
static int compare(UserAccount a, UserAccount b)
          Compare two UserAccount objects for order.
 java.lang.String getHost()
          Return the host for this object.
 java.lang.String getLabel()
          Return the label for this object.
 java.lang.String getPassword()
          Return the password for this object.
 java.lang.String getUsername()
          Return the username for this object.
 void readFields(java.io.DataInputStream is)
          Read the data for this object from the given DataInputStream.
 void setHost(java.lang.String host)
          Set the host for this object.
 void setLabel(java.lang.String label)
          Set the label for this object.
 void setPassword(java.lang.String password)
          Set the password for this object.
 void setUsername(java.lang.String username)
          Set the username for this object.
 void writeFields(java.io.DataOutputStream os)
          Write the data for this object out onto the given DataOutputStream.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UserAccount

public UserAccount()
Construct a new UserAccount object with empty Strings for all of the fields.


UserAccount

public UserAccount(java.lang.String label,
                   java.lang.String host,
                   java.lang.String username,
                   java.lang.String password)
Construct a new UserAccount object using the supplied strings. If any of the parameters are null, an empty String will be used instead.

Parameters:
label - the display name of this account
host - the host computer for which this account name is defined
username - the name associated with this user
password - the password for this account
Method Detail

getLabel

public java.lang.String getLabel()
Return the label for this object.

Returns:
the label String

getHost

public java.lang.String getHost()
Return the host for this object.

Returns:
the host String

getUsername

public java.lang.String getUsername()
Return the username for this object.

Returns:
the username String

getPassword

public java.lang.String getPassword()
Return the password for this object.

Returns:
the password String

setLabel

public void setLabel(java.lang.String label)
Set the label for this object.

Parameters:
label - the label String

setHost

public void setHost(java.lang.String host)
Set the host for this object.

Parameters:
host - the host String

setUsername

public void setUsername(java.lang.String username)
Set the username for this object.

Parameters:
username - the username String

setPassword

public void setPassword(java.lang.String password)
Set the password for this object.

Parameters:
password - the password String

writeFields

public void writeFields(java.io.DataOutputStream os)
                 throws java.io.IOException
Write the data for this object out onto the given DataOutputStream.

Specified by:
writeFields in interface Storable
Parameters:
os - the DataOutputStream on which to write the data fields for this object.
Throws:
java.io.IOException - if an error occurs while writing

readFields

public void readFields(java.io.DataInputStream is)
                throws java.io.IOException
Read the data for this object from the given DataInputStream.

Specified by:
readFields in interface Storable
Parameters:
is - the DataInputStream from which to read the data fields for this object.
Throws:
java.io.IOException - if an error occurs while reading

compare

public static int compare(UserAccount a,
                          UserAccount b)
Compare two UserAccount objects for order.

Parameters:
a - the first object in the comparison
b - the second object in the comparison
Returns:
-1, 0, or +1 as the first argument is less than, equal to, or greater than the second.