Package org.openrefine.importers
Class TabularParserHelper
- java.lang.Object
-
- org.openrefine.importers.TabularParserHelper
-
public class TabularParserHelper extends Object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
TabularParserHelper.TableDataReader
-
Constructor Summary
Constructors Constructor Description TabularParserHelper()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description com.fasterxml.jackson.databind.node.ObjectNode
createParserUIInitializationData(com.fasterxml.jackson.databind.node.ObjectNode options)
static Grid
parseOneFile(Runner runner, String fileSource, String archiveFileName, CloseableIterable<Row> dataReader, long limit, com.fasterxml.jackson.databind.node.ObjectNode options)
Parse a grid from a stream of rows, handling the generic processing generally available in tabular importers.Grid
parseOneFile(Runner runner, ProjectMetadata metadata, ImportingJob job, String fileSource, String archiveFileName, TabularParserHelper.TableDataReader dataReader, long limit, com.fasterxml.jackson.databind.node.ObjectNode options)
Deprecated.useparseOneFile(Runner, String, String, CloseableIterable, long, ObjectNode)
because it avoids loading the entire grid in memory.static Grid
prependColumn(String columnName, String cellValue, Grid grid)
Adds a column to the grid, with the same string content in all cells.
-
-
-
Method Detail
-
createParserUIInitializationData
public com.fasterxml.jackson.databind.node.ObjectNode createParserUIInitializationData(com.fasterxml.jackson.databind.node.ObjectNode options)
-
parseOneFile
public static Grid parseOneFile(Runner runner, String fileSource, String archiveFileName, CloseableIterable<Row> dataReader, long limit, com.fasterxml.jackson.databind.node.ObjectNode options)
Parse a grid from a stream of rows, handling the generic processing generally available in tabular importers. This covers column name extraction from header rows, blank cell and row handling, datatype detection and addition of columns for archive and file sources. This function will do one pass over the entire grid before returning theGrid
object, counting its rows and normalizing all rows to have the same number of cells.- Parameters:
runner
- the runner to use to create the gridfileSource
- the name of the file this is parsed fromarchiveFileName
- the name of the zip archive the file comes fromdataReader
- the iterable of rows for the gridlimit
- the maximum number of rows to store in the grid (not counting headers and skipped rows)options
- a map of parsing options
-
parseOneFile
@Deprecated public Grid parseOneFile(Runner runner, ProjectMetadata metadata, ImportingJob job, String fileSource, String archiveFileName, TabularParserHelper.TableDataReader dataReader, long limit, com.fasterxml.jackson.databind.node.ObjectNode options) throws Exception
Deprecated.useparseOneFile(Runner, String, String, CloseableIterable, long, ObjectNode)
because it avoids loading the entire grid in memory.- Throws:
Exception
-
prependColumn
public static Grid prependColumn(String columnName, String cellValue, Grid grid)
Adds a column to the grid, with the same string content in all cells. The column is added at the beginning of the grid.- Parameters:
columnName
- the name of the column to addcellValue
- the constant value in this columngrid
- the original grid to start from- Returns:
- a modified copy of the grid
-
-