Package org.openrefine.importers
Class SeparatorBasedImporter
- java.lang.Object
-
- org.openrefine.importers.ImportingParserBase
-
- org.openrefine.importers.ReaderImporter
-
- org.openrefine.importers.SeparatorBasedImporter
-
- All Implemented Interfaces:
ImportingParser
public class SeparatorBasedImporter extends ReaderImporter
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
SeparatorBasedImporter.Separator
-
Constructor Summary
Constructors Constructor Description SeparatorBasedImporter()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description com.fasterxml.jackson.databind.node.ObjectNode
createParserUIInitializationData(Runner runner, ImportingJob job, List<ImportingFileRecord> fileRecords, String format)
Create data sufficient for the parser UI on the client side to do its work.protected static ArrayList<Object>
getCells(String line, au.com.bytecode.opencsv.CSVParser parser, Iterator<IndexedRow> lines)
static SeparatorBasedImporter.Separator
guessSeparator(File file, String encoding)
static SeparatorBasedImporter.Separator
guessSeparator(File file, String encoding, boolean handleQuotes)
static String
guessSeparator(ImportingJob job, List<ImportingFileRecord> fileRecords)
Grid
parseOneFile(Runner runner, ProjectMetadata metadata, ImportingJob job, String fileSource, String archiveFileName, Supplier<Reader> reader, long limit, com.fasterxml.jackson.databind.node.ObjectNode options)
Parses one file, read from aReader
object, into a Grid.-
Methods inherited from class org.openrefine.importers.ImportingParserBase
parse, parseOneFile
-
-
-
-
Method Detail
-
createParserUIInitializationData
public com.fasterxml.jackson.databind.node.ObjectNode createParserUIInitializationData(Runner runner, ImportingJob job, List<ImportingFileRecord> fileRecords, String format)
Description copied from interface:ImportingParser
Create data sufficient for the parser UI on the client side to do its work. For example, an XML parser UI would need to know some sample elements so it can let the user pick which the path to the record elements.- Specified by:
createParserUIInitializationData
in interfaceImportingParser
- Overrides:
createParserUIInitializationData
in classReaderImporter
-
parseOneFile
public Grid parseOneFile(Runner runner, ProjectMetadata metadata, ImportingJob job, String fileSource, String archiveFileName, Supplier<Reader> reader, long limit, com.fasterxml.jackson.databind.node.ObjectNode options) throws Exception
Description copied from class:ReaderImporter
Parses one file, read from aReader
object, into a Grid.- Specified by:
parseOneFile
in classReaderImporter
- Parameters:
runner
- the runner to use (the returned Grid will be generated by it)metadata
- the project metadata associated with the project to parse (which can be modified by the importer)job
- the importing job where this import is being donefileSource
- the path or source of the file (could be "clipboard" or a URL as well)archiveFileName
- the path or source of the archive the file was extracted fromreader
- the reader object where to read the data fromlimit
- the maximum number of rows to readoptions
- any options passed to the importer as a JSON payload- Returns:
- a parsed Grid
- Throws:
Exception
-
getCells
protected static ArrayList<Object> getCells(String line, au.com.bytecode.opencsv.CSVParser parser, Iterator<IndexedRow> lines) throws IOException
- Throws:
IOException
-
guessSeparator
public static String guessSeparator(ImportingJob job, List<ImportingFileRecord> fileRecords)
-
guessSeparator
public static SeparatorBasedImporter.Separator guessSeparator(File file, String encoding)
-
guessSeparator
public static SeparatorBasedImporter.Separator guessSeparator(File file, String encoding, boolean handleQuotes)
-
-