コード例 #1
0
  @Override
  public int serialize(ByteBuffer outputBuffer) throws UDRException {

    int origPos = outputBuffer.position();

    super.serialize(outputBuffer);
    int numCols = uniqueColumns_.size();

    // add the binary length of the following array
    serializeInt(numCols * 4, outputBuffer);

    for (int u = 0; u < numCols; u++) outputBuffer.putInt(uniqueColumns_.get(u).intValue());

    int bytesSerialized = outputBuffer.position() - origPos;

    validateSerializedLength(bytesSerialized);

    return bytesSerialized;
  }
コード例 #2
0
  @Override
  public int deserialize(ByteBuffer inputBuffer) throws UDRException {
    int numCols = 0;

    int origPos = inputBuffer.position();

    super.deserialize(inputBuffer);
    validateObjectType(TMUDRObjectType.UNIQUE_CONSTRAINT_INFO_OBJ);

    numCols = deserializeInt(inputBuffer) / 4;

    for (int u = 0; u < numCols; u++) {
      uniqueColumns_.add(deserializeInt(inputBuffer));
    }

    int bytesDeserialized = inputBuffer.position() - origPos;

    validateDeserializedLength(bytesDeserialized);

    return bytesDeserialized;
  }