org.w3c.tools.resources.upgrade
Class StringAttribute

java.lang.Object
  extended by org.w3c.tools.resources.upgrade.Attribute
      extended by org.w3c.tools.resources.upgrade.StringAttribute
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
EncodingAttribute, FilenameAttribute, LanguageAttribute, PasswordAttribute

public class StringAttribute
extends Attribute

The generic description of an StringAttribute.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class org.w3c.tools.resources.upgrade.Attribute
COMPUTED, DONTSAVE, EDITABLE, flags, MANDATORY, name, type
 
Constructor Summary
StringAttribute(java.lang.String name, java.lang.String def, java.lang.Integer flags)
          Create a description for a generic String attribute.
 
Method Summary
 boolean checkValue(java.lang.Object obj)
          Is the given object a valid StringAttribute value ?
 int getPickleLength(java.lang.Object value)
          Get the number of bytes required to save that attribute value.
 void pickle(java.io.DataOutputStream out, java.lang.Object i)
          Pickle an string to the given output stream.
 java.lang.Object unpickle(java.io.DataInputStream in)
          Unpickle an string from the given input stream.
 
Methods inherited from class org.w3c.tools.resources.upgrade.Attribute
checkFlag, getDefault, getName, getType, stringify
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StringAttribute

public StringAttribute(java.lang.String name,
                       java.lang.String def,
                       java.lang.Integer flags)
Create a description for a generic String attribute.

Parameters:
name - The attribute name.
def - The default value for these attributes.
flags - The associated flags.
Method Detail

checkValue

public boolean checkValue(java.lang.Object obj)
Is the given object a valid StringAttribute value ?

Specified by:
checkValue in class Attribute
Parameters:
obj - The object to test.
Returns:
A boolean true if value is valid.

getPickleLength

public final int getPickleLength(java.lang.Object value)
Get the number of bytes required to save that attribute value.

Specified by:
getPickleLength in class Attribute
Parameters:
The - value about to be pickled.
Returns:
The number of bytes needed to pickle that value.

pickle

public void pickle(java.io.DataOutputStream out,
                   java.lang.Object i)
            throws java.io.IOException
Pickle an string to the given output stream.

Specified by:
pickle in class Attribute
Parameters:
out - The output stream to pickle to.
obj - The object to pickle.
Throws:
java.io.IOException - If some IO error occured.

unpickle

public java.lang.Object unpickle(java.io.DataInputStream in)
                          throws java.io.IOException
Unpickle an string from the given input stream. the empty string defaults to a null object

Specified by:
unpickle in class Attribute
Parameters:
in - The input stream to unpickle from.
Returns:
An instance of String.
Throws:
java.io.IOException - If some IO error occured.