| java.lang.Object com.sun.portal.search.soif.AVPair
AVPair | public class AVPair (Code) | | AVPair - a class used to represent a SOIF attribute-value pair.
SOIF AVPairs may be text or binary. Other types should be encoded by convention.
SOIF AVPairs may be multivalued.
This implementation will save data as either strings or byte arrays.
If data is saved as a byte array, but requested as a string, an implicit
conversion from binary to text is performed using the current character encoding.
A conversion is also performed when an attribute is written in one
encoding, but read in another.
NB: byte array entries are stored by reference and shared with caller.
String entries are never shared.
See Also: SOIF |
Inner Class :class AVValue | |
Constructor Summary | |
| AVPair() | public | AVPair(String att) | public | AVPair(String att, String val) Constructs a new AVPairs instance with a String value. | public | AVPair(String att, byte[] bval) Constructs a new AVPairs instance with a byte array value. | public | AVPair(String att, String val, int index) Constructs an AVPair consisting of a String value with the given index. | public | AVPair(String att, byte[] bval, int index) Constructs an AVPair consisting of a byte array value with the given index. | public | AVPair(String att, byte[] bval, int index, String encoding) Constructs an AVPair consisting of a String value with the given index and encoding. |
attribute | public String attribute(Code) | | Attribute name. Multivalued attr bob-1, bob-2, bob-4 have the name bob.
Case is preserved, although SOIF lookups are case insensitive.
|
value | public AVValue[] value(Code) | | Attribute value. Can be binary (assumed when reading from stream)
For internal use, directly supports String values for efficiency.
|
AVPair | AVPair()(Code) | | Constructs an empty, unnamed AVPair instance (mainly for testing)
|
AVPair | public AVPair(String att)(Code) | | Constructs an empty, named AVPair instance
Parameters: att - the attribute |
AVPair | public AVPair(String att, String val)(Code) | | Constructs a new AVPairs instance with a String value.
Parameters: att - the attribute Parameters: val - the value |
AVPair | public AVPair(String att, byte[] bval)(Code) | | Constructs a new AVPairs instance with a byte array value.
Parameters: att - the attribute Parameters: val - the value |
AVPair | public AVPair(String att, String val, int index)(Code) | | Constructs an AVPair consisting of a String value with the given index.
|
AVPair | public AVPair(String att, byte[] bval, int index)(Code) | | Constructs an AVPair consisting of a byte array value with the given index.
|
AVPair | public AVPair(String att, byte[] bval, int index, String encoding)(Code) | | Constructs an AVPair consisting of a String value with the given index and encoding.
|
contentSize | public int contentSize()(Code) | | size of AVPair contents in bytes |
ensureCapacity | protected void ensureCapacity(int size)(Code) | | Ensure arrays are big enough
- blocking factor?
- use a single Object array?
|
getAttribute | public String getAttribute()(Code) | | the attribute name for this AVPair. |
getByteValues | public byte[][] getByteValues()(Code) | | Gets all valid values of this attribute.
an array of byte arrays formultiple values for an attribute, e.g., for image, returnvalues for image-1 and image-2. |
getBytes | public byte[] getBytes()(Code) | | the value of this AVPair (uses the first occupied slot if multivalued) |
getBytes | public byte[] getBytes(int i)(Code) | | Parameters: i - multivalue index byte array value at index i |
getMaxIndex | public int getMaxIndex()(Code) | | the maximum occupied index. |
getStringValues | public String[] getStringValues()(Code) | | Gets all valid values of this attribute.
an array of Strings formultiple values for an attribute, e.g., for Bob, returnvalues for Bob-1 and Bob-2. |
getValue | public String getValue()(Code) | | the value of this AVPair (uses the first occupied slot if multivalued) |
getValue | public String getValue(int i)(Code) | | Parameters: i - multivalue index String value at index i |
insert | public boolean insert(String v, int index)(Code) | | Inserts a String at the given index, no duplicates.
false if slot already taken |
insert | public boolean insert(byte[] b, int index)(Code) | | Inserts a byte array at the given index, no duplicates.
false if slot already taken |
isMV | public boolean isMV()(Code) | | true if APVair is multivalued |
nthValid | public boolean nthValid(int n)(Code) | | true if the value at index n exists and is non-null |
remove | public boolean remove(int index)(Code) | | Removes a mutivalued entry by index.
false if index was not occupied |
replace | public boolean replace(String v, int index)(Code) | | Replaces the string at the given index.
false if slot already taken |
replace | public boolean replace(byte[] b, int index)(Code) | | Replaces the byte array at the given index.
false if slot already taken |
setAttribute | public void setAttribute(String s)(Code) | | (Re)names an AVPair.
|
size | public int size()(Code) | | the total size - some values may be null |
squeeze | public void squeeze()(Code) | | Packs the index array by closing all holes towards the index zero.
|
toString | public String toString()(Code) | | a String representation of this AVPair - mainly for debugging |
valueCount | public int valueCount()(Code) | | the number of non-null values for this attribute. |
|
|