Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.novell.service.bindery
Class BinderyPropertyDataSegment

    java.lang.Object
      |
      +--com.novell.service.bindery.BinderyPropertyDataSegment

public class BinderyPropertyDataSegment
extends java.lang.Object

Holds a 128-byte data segment containing the data of a Bindery Property. It is used as an Attribute Value attached to the Bindery Properties attribute.

This class is immutable, which means once it is created it cannot be changed (except for adding more data segments). To make modifications, extract the data not to be changed, create a new object with the old object, and add the new data.

Field Summary
`static int` | `SEGMENT_LENGTH` The official length of a data segment in the bindery.

Constructor Summary
`BinderyPropertyDataSegment(byte[] seg, int segNum, int segFlag)` Constructs a property data segment from a byte array.
`BinderyPropertyDataSegment(java.util.Vector vseg, int segNum, int segFlag)` Construct a property data segment from a vector of integers.

Method Summary
`boolean` | `equals(java.lang.Object obj)` Compares the set data passed in the Object parameter with the current segment.
`byte[]` | `getByteData()` Returns a byte array from which a new property data segment can be created.
`int` | `getSegFlag()` Returns the data segment property flag.
`int` | `getSegNum()` Returns the number of this data segment.
`java.util.Vector` | `getSetData()` Returns a set of bindery IDs.
`boolean` | `isSet()` Determines if this data segment contains Set data.
`java.lang.String` | `toString()` Returns a string representation of this bindery segment.

Methods inherited from class java.lang.Object
`clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Field Detail

### SEGMENT_LENGTH

    public static final int SEGMENT_LENGTH

  The official length of a data segment in the bindery.

  (SEGMENT_LENGTH = 128)

Constructor Detail

### BinderyPropertyDataSegment

    public BinderyPropertyDataSegment(byte[] seg,
                                      int segNum,
                                      int segFlag)
                               throws com.novell.service.jncp.NSIException

  Constructs a property data segment from a byte array.
  Parameters:
    `seg` - The byte array. If this array is less than 128, the remainder of the segment is 0 padded.
    `segNum` - The number of this segment (1 based).
    `segFlag` - The property flag (BF_ITEM, BF_SET), which should match the property type.
  Throws:
    com.novell.service.jncp.NSIException - If the size of the array is greater than 128 bytes.

### BinderyPropertyDataSegment

    public BinderyPropertyDataSegment(java.util.Vector vseg,
                                      int segNum,
                                      int segFlag)

  Construct a property data segment from a vector of integers.
  Parameters:
    `vseg` - A vector of integers to be put into the data segment. If the vector contains more than 32 entries, the remaining entries are ignored. If the vector contains fewer than 32 entries the remainder of the segment is 0 padded.
    `segNum` - The number of this segment (1 based).
    `segFlag` - The property flag (BF_ITEM, BF_SET),which should match the property type.

Method Detail

### getByteData

    public byte[] getByteData()

  Returns a byte array from which a new property data segment can be created. This is useful when the user wants to manipulate the byte array in order to create a new BinderyPropertyDataSegment.
  Returns:
    A byte array.

### getSegNum

    public int getSegNum()

  Returns the number of this data segment.
  Returns:
    The number of this data segment.

### getSegFlag

    public int getSegFlag()

  Returns the data segment property flag.
  Returns:
    The property's flag.

### isSet

    public boolean isSet()

  Determines if this data segment contains Set data.
  Returns:
    A boolean set to TRUE if this data segment contains Set data, otherwise set to FALSE.

### getSetData

    public java.util.Vector getSetData()

  Returns a set of bindery IDs. If data is not a set of IDs, a null vector is returned because there is no obvious exception to throw.
  Returns:
    The bindery IDs as a Vector.

### equals

    public boolean equals(java.lang.Object obj)

  Compares the set data passed in the Object parameter with the current segment.

  If the 2 segments are Set data, then equality is determined by finding all the IDs in the parameter that match the current segment, regardless of order or extra IDs. This is done so that you can search for a single ID in properties that have many. If the two segments are not Set data, every byte in the segment must be identical.

  Parameters:
    `obj` - The Object with which to compare the current segment.
  Returns:
    A boolean set to TRUE if the two segments match, otherwise set to FALSE.
  Overrides:
    equals in class java.lang.Object

### toString

    public java.lang.String toString()

  Returns a string representation of this bindery segment.

  Bindery segment data does not lend itself to becoming a string because its format is ill-defined. The only known definition is IF it is Set data, in which each 4 bytes are the ID of another bindery object. If it is not Set data the segment can be anything. This toString() method checks to see if anything falls into the pattern of a c-string and displays it that way if possible. If not, a string of bytes in hex format is output.

  Overrides:
    toString in class java.lang.Object

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD