public void setNumFields ( final int numFields ) { final int oldNumFields = this . numFields ; // check whether we increase or decrease the fields if ( numFields > oldNumFields ) { makeSpace ( numFields ) ; for ( int i = oldNumFields ; i < numFields ; i ++ ) { this . offsets [ i ] = NULL_INDICATOR_OFFSET ; } markModified ( oldNumFields ) ; } else { // decrease the number of fields // we do not remove the values from the cache, as the objects (if they are there) will most likely // be reused when the record is re-filled markModified ( numFields ) ; } this . numFields = numFields ; }
Sets the number of fields in the record . If the new number of fields is longer than the current number of fields then null fields are appended . If the new number of fields is smaller than the current number of fields then the last fields are truncated .