com.sas.collection.hlist
Class ArrayItem

java.lang.Object
  |
  +--com.sas.collection.hlist.HListItem
        |
        +--com.sas.collection.hlist.ArrayItem
All Implemented Interfaces:
PublicClonable,

public class ArrayItem
extends HListItem

An item for storing an array in an HList. Array support is new in release 1.2 and on the SAS server SCL lists for 8.0. Arrays can be arrays of Java primitive types: boolean, byte, char, short, int, long, float, double, or an array of String, or an array of HList lists. Arrays of objects (other than java.lang.String) are not allowed. Note that if you wish to reference SCL objects, you may use an array of object ids.

Since:
1.2
See Also:
HList, Serialized Form

Field Summary
protected  Object array
          The array value.
static byte itemType
          The code used to mark a ArrayItem in IO_VERSION_3 and greater I/O streams.
static String RB_KEY
           
static char streamCode
          The code used to mark a ArrayItem in I/O streams.
 
Fields inherited from class com.sas.collection.hlist.HListItem
classTable, ITEM_ATTR_MASK, ITEM_HAS_ATTRS, ITEM_HAS_NAME, name
 
Constructor Summary
ArrayItem()
          Default constructor, the array value null.
ArrayItem(ArrayItem item)
          Copy constructor, the array value is null
ArrayItem(Object array)
          Value constructor
ArrayItem(Object array, String name)
          Value constructor
ArrayItem(Object array, String name, short attributes)
          Value constructor
 
Method Summary
 boolean equals(Object other)
           
 Object getValue()
          Return the object value
protected  byte itemType()
          Return the code to identify this data type in data streams.
 void read(DataInputStream stream, StreamEnv env)
          Read an array item from the input stream.
 void setValue(Object object)
          Set the object value
protected  char streamCode()
          Return the stream code.
 Object toObject()
          Return the array of the item, as an object.
 String toString()
          convert an item to a string
 void write(DataOutputStream stream, StreamEnv env)
          Write an array item from the output stream.
 
Methods inherited from class com.sas.collection.hlist.HListItem
add, add, clone, getName, hasAttribute, hasAttributes, intern, newFromStream, newFromStream, read, readString, readUTF, setAttribute, setAttributes, setAttributes, setName, write, writeString
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

RB_KEY

public static final String RB_KEY

array

protected Object array
The array value.

streamCode

public static final char streamCode
The code used to mark a ArrayItem in I/O streams.

itemType

public static final byte itemType
The code used to mark a ArrayItem in IO_VERSION_3 and greater I/O streams.
Constructor Detail

ArrayItem

public ArrayItem()
Default constructor, the array value null.

ArrayItem

public ArrayItem(ArrayItem item)
Copy constructor, the array value is null
Parameters:
item - another ArrayItem

ArrayItem

public ArrayItem(Object array)
Value constructor
Parameters:
array - the object to store in the item. This may be null.

ArrayItem

public ArrayItem(Object array,
                 String name)
Value constructor
Parameters:
array - the object to store in the item. This may be null.
name - the name of this item

ArrayItem

public ArrayItem(Object array,
                 String name,
                 short attributes)
Value constructor
Parameters:
array - the object to store in the item. This may be null.
name - the name of this item
attributes - the item attributes
Method Detail

getValue

public Object getValue()
Return the object value
Returns:
the object value

setValue

public void setValue(Object object)
Set the object value
Parameters:
object - the new object value

equals

public boolean equals(Object other)
Overrides:
equals in class Object

streamCode

protected final char streamCode()
Return the stream code.
Overrides:
streamCode in class HListItem
See Also:
streamCode

itemType

protected final byte itemType()
Return the code to identify this data type in data streams.
Overrides:
itemType in class HListItem
See Also:
itemType

toObject

public final Object toObject()
Return the array of the item, as an object. This is an alias for getValue()
Overrides:
toObject in class HListItem
Returns:
the array of the item, as an object

toString

public String toString()
convert an item to a string
Overrides:
toString in class HListItem
Returns:
the string representation of the item

write

public void write(DataOutputStream stream,
                  StreamEnv env)
           throws IOException
Write an array item from the output stream.
Overrides:
write in class HListItem
Parameters:
stream - a stream where a HList is being written.
Throws:
IOException - if there is an error writing to the stream.

read

public void read(DataInputStream stream,
                 StreamEnv env)
          throws IOException
Read an array item from the input stream.
Overrides:
read in class HListItem
Parameters:
stream - a stream where a HList has been written.
Throws:
IOException - if there is an error reading from the stream.




Copyright © 2005 SAS Institute Inc. All Rights Reserved.
javadoc generated Thu, 16 Feb 2006 01:49:10