Search in sources :

Example 6 with BlobSupportDataRow

use of org.knime.core.data.container.BlobSupportDataRow in project knime-core by knime.

the class BlobSupportDataCellList method create.

/**
 * Create new list based on selected cell from a {@link DataRow}. Using
 * this method will check if the row is returned by a
 * {@link BufferedDataTable} and will handle blobs appropriately.
 *
 * @param row The underlying row
 * @param cols The indices of interest.
 * @return A newly create list.
 * @throws NullPointerException If either argument is null.
 * @throws IndexOutOfBoundsException If the indices are invalid.
 */
public static BlobSupportDataCellList create(final DataRow row, final int[] cols) {
    ArrayList<DataCell> coll = new ArrayList<DataCell>(cols.length);
    for (int i = 0; i < cols.length; i++) {
        DataCell c;
        if (row instanceof BlobSupportDataRow) {
            c = ((BlobSupportDataRow) row).getRawCell(cols[i]);
        } else {
            c = row.getCell(cols[i]);
        }
        coll.add(c);
    }
    return create(coll);
}
Also used : BlobSupportDataRow(org.knime.core.data.container.BlobSupportDataRow) ArrayList(java.util.ArrayList) BlobWrapperDataCell(org.knime.core.data.container.BlobWrapperDataCell) BlobDataCell(org.knime.core.data.container.BlobDataCell) DataCell(org.knime.core.data.DataCell)

Aggregations

BlobSupportDataRow (org.knime.core.data.container.BlobSupportDataRow)6 DataCell (org.knime.core.data.DataCell)4 ArrayList (java.util.ArrayList)3 DataRow (org.knime.core.data.DataRow)2 BlobDataCell (org.knime.core.data.container.BlobDataCell)2 BlobWrapperDataCell (org.knime.core.data.container.BlobWrapperDataCell)2 DataTableSpec (org.knime.core.data.DataTableSpec)1 RowKey (org.knime.core.data.RowKey)1 IntCell (org.knime.core.data.def.IntCell)1 BufferedDataContainer (org.knime.core.node.BufferedDataContainer)1 CanceledExecutionException (org.knime.core.node.CanceledExecutionException)1