private void readObj( DataInputStream dis ) throws IOException { // First handle the number of fields in a row int size = dis.readInt(); // get all values in the row for ( int i = 0; i < size; i++ ) { Value v = new Value(); v.readObj( dis ); addValue( v ); } }
/** * Add all the values of row r to the Row. * * @param r * The row to be added to this row. */ public void addRow( Row r ) { if ( r == null ) { return; } int i; for ( i = 0; i < r.size(); i++ ) { Value v1 = r.getValue( i ); addValue( v1 ); } }
public Row( Node rowNode ) { int nrValues = XMLHandler.countNodes( rowNode, Value.XML_TAG ); for ( int i = 0; i < nrValues; i++ ) { Node valueNode = XMLHandler.getSubNodeByNr( rowNode, Value.XML_TAG, i ); addValue( new Value( valueNode ) ); } }
public static Row createOriginalRow( RowMetaInterface rowMeta, Object[] rowData ) throws KettleValueException { Row row = new Row(); for ( int i = 0; i < rowMeta.size(); i++ ) { ValueMetaInterface valueMeta = rowMeta.getValueMeta( i ); Object valueData = rowData[ i ]; Value value = valueMeta.createOriginalValue( valueData ); row.addValue( value ); } return row; }
/** * Merge the values of row r to this Row. Merge means: only the values that are not yet in the row are added * (comparing on the value name). * * @param r * The row to be merged with this row */ public void mergeRow( Row r ) { if ( r == null ) { return; } for ( int x = 0; x < r.size(); x++ ) { Value field = r.getValue( x ); if ( searchValue( field.getName() ) == null ) { addValue( field ); // Not in list yet: add } } }
/** * Creates a new row as a duplicate of the given row. The values are copied one by one into new values. * * @param r * The row to be copied. */ // Copy values in row! public Row( Row r ) { this(); for ( int i = 0; i < r.size(); i++ ) { addValue( new Value( r.getValue( i ) ) ); } setIgnore( r.isIgnored() ); }
/** * Read a number of Values without meta-data into a row. * * @param dis * The DataInputStream to read from * @param size * the number or values to read * @param meta * The description (name, type, length, precision) of the values to be read * @throws KettleFileException * if the row couldn't be created by reading from the data input stream. */ public Row( DataInputStream dis, int size, Row meta ) throws KettleFileException { try { // get all values in the row for ( int i = 0; i < size; i++ ) { addValue( new Value( meta.getValue( i ), dis ) ); } } catch ( KettleEOFException e ) { throw new KettleEOFException( BaseMessages.getString( PKG, "Row.EndOfFileReadingRow" ), e ); } catch ( Exception e ) { throw new KettleFileException( BaseMessages.getString( PKG, "Row.RowError" ), e ); } }