public class ImportUtil extends Object
ImportUtil.Builder for convenient configuration of the
 import functionality.  Note that most scenarios for customizing input data
 can be handled by implementing a custom ImportFilter.| Modifier and Type | Class and Description | 
|---|---|
static class  | 
ImportUtil.Builder
Builder which simplifies configuration of an import operation. 
 | 
| Modifier and Type | Method and Description | 
|---|---|
static String | 
importFile(File f,
          Database db,
          String name,
          String delim)
Copy a delimited text file into a new table in this database. 
 | 
static String | 
importFile(File f,
          Database db,
          String name,
          String delim,
          char quote,
          ImportFilter filter,
          boolean useExistingTable)
Copy a delimited text file into a new table in this database. 
 | 
static String | 
importFile(File f,
          Database db,
          String name,
          String delim,
          char quote,
          ImportFilter filter,
          boolean useExistingTable,
          boolean header)
Copy a delimited text file into a new table in this database. 
 | 
static String | 
importFile(File f,
          Database db,
          String name,
          String delim,
          ImportFilter filter)
Copy a delimited text file into a new table in this database. 
 | 
static String | 
importReader(BufferedReader in,
            Database db,
            String name,
            String delim)
Copy a delimited text file into a new table in this database. 
 | 
static String | 
importReader(BufferedReader in,
            Database db,
            String name,
            String delim,
            char quote,
            ImportFilter filter,
            boolean useExistingTable)
Copy a delimited text file into a new (or optionally exixsting) table in
 this database. 
 | 
static String | 
importReader(BufferedReader in,
            Database db,
            String name,
            String delim,
            char quote,
            ImportFilter filter,
            boolean useExistingTable,
            boolean header)
Copy a delimited text file into a new (or optionally exixsting) table in
 this database. 
 | 
static String | 
importReader(BufferedReader in,
            Database db,
            String name,
            String delim,
            ImportFilter filter)
Copy a delimited text file into a new table in this database. 
 | 
static String | 
importReader(BufferedReader in,
            Database db,
            String name,
            String delim,
            ImportFilter filter,
            boolean useExistingTable)
Copy a delimited text file into a new (or optionally exixsting) table in
 this database. 
 | 
static String | 
importResultSet(ResultSet source,
               Database db,
               String name)
Copy an existing JDBC ResultSet into a new table in this database. 
 | 
static String | 
importResultSet(ResultSet source,
               Database db,
               String name,
               ImportFilter filter)
Copy an existing JDBC ResultSet into a new table in this database. 
 | 
static String | 
importResultSet(ResultSet source,
               Database db,
               String name,
               ImportFilter filter,
               boolean useExistingTable)
Copy an existing JDBC ResultSet into a new (or optionally existing) table
 in this database. 
 | 
static List<ColumnBuilder> | 
toColumns(ResultSetMetaData md)
Returns a List of Column instances converted from the given
 ResultSetMetaData (this is the same method used by the various  
importResultSet() methods). | 
public static List<ColumnBuilder> toColumns(ResultSetMetaData md) throws SQLException, IOException
importResultSet() methods).SQLExceptionIOExceptionpublic static String importResultSet(ResultSet source, Database db, String name) throws SQLException, IOException
 Equivalent to:
 importResultSet(source, db, name, SimpleImportFilter.INSTANCE);
name - Name of the new table to createsource - ResultSet to copy fromSQLExceptionIOExceptionimportResultSet(ResultSet,Database,String,ImportFilter), 
ImportUtil.Builderpublic static String importResultSet(ResultSet source, Database db, String name, ImportFilter filter) throws SQLException, IOException
 Equivalent to:
 importResultSet(source, db, name, filter, false);
name - Name of the new table to createsource - ResultSet to copy fromfilter - valid import filterSQLExceptionIOExceptionimportResultSet(ResultSet,Database,String,ImportFilter,boolean), 
ImportUtil.Builderpublic static String importResultSet(ResultSet source, Database db, String name, ImportFilter filter, boolean useExistingTable) throws SQLException, IOException
name - Name of the new table to createsource - ResultSet to copy fromfilter - valid import filteruseExistingTable - if true use current table if it already
                         exists, otherwise, create new table with unique
                         nameSQLExceptionIOExceptionImportUtil.Builderpublic static String importFile(File f, Database db, String name, String delim) throws IOException
 Equivalent to:
 importFile(f, name, db, delim, SimpleImportFilter.INSTANCE);
name - Name of the new table to createf - Source file to importdelim - Regular expression representing the delimiter string.IOExceptionimportFile(File,Database,String,String,ImportFilter), 
ImportUtil.Builderpublic static String importFile(File f, Database db, String name, String delim, ImportFilter filter) throws IOException
 Equivalent to:
 importFile(f, name, db, delim, "'", filter, false);
name - Name of the new table to createf - Source file to importdelim - Regular expression representing the delimiter string.filter - valid import filterIOExceptionimportReader(BufferedReader,Database,String,String,ImportFilter), 
ImportUtil.Builderpublic static String importFile(File f, Database db, String name, String delim, char quote, ImportFilter filter, boolean useExistingTable) throws IOException
 Equivalent to:
 importReader(new BufferedReader(new FileReader(f)), db, name, delim, "'", filter, useExistingTable, true);
name - Name of the new table to createf - Source file to importdelim - Regular expression representing the delimiter string.quote - the quote characterfilter - valid import filteruseExistingTable - if true use current table if it already
                         exists, otherwise, create new table with unique
                         nameIOExceptionimportReader(BufferedReader,Database,String,String,ImportFilter,boolean), 
ImportUtil.Builderpublic static String importFile(File f, Database db, String name, String delim, char quote, ImportFilter filter, boolean useExistingTable, boolean header) throws IOException
 Equivalent to:
 importReader(new BufferedReader(new FileReader(f)), db, name, delim, "'", filter, useExistingTable, header);
name - Name of the new table to createf - Source file to importdelim - Regular expression representing the delimiter string.quote - the quote characterfilter - valid import filteruseExistingTable - if true use current table if it already
                         exists, otherwise, create new table with unique
                         nameheader - if false the first line is not a header row, only
               valid if useExistingTable is trueIOExceptionimportReader(BufferedReader,Database,String,String,char,ImportFilter,boolean,boolean), 
ImportUtil.Builderpublic static String importReader(BufferedReader in, Database db, String name, String delim) throws IOException
 Equivalent to:
 importReader(in, db, name, delim, SimpleImportFilter.INSTANCE);
name - Name of the new table to createin - Source reader to importdelim - Regular expression representing the delimiter string.IOExceptionimportReader(BufferedReader,Database,String,String,ImportFilter), 
ImportUtil.Builderpublic static String importReader(BufferedReader in, Database db, String name, String delim, ImportFilter filter) throws IOException
 Equivalent to:
 importReader(in, db, name, delim, filter, false);
name - Name of the new table to createin - Source reader to importdelim - Regular expression representing the delimiter string.filter - valid import filterIOExceptionimportReader(BufferedReader,Database,String,String,ImportFilter,boolean), 
ImportUtil.Builderpublic static String importReader(BufferedReader in, Database db, String name, String delim, ImportFilter filter, boolean useExistingTable) throws IOException
 Equivalent to:
 importReader(in, db, name, delim, '"', filter, false);
name - Name of the new table to createin - Source reader to importdelim - Regular expression representing the delimiter string.filter - valid import filteruseExistingTable - if true use current table if it already
                         exists, otherwise, create new table with unique
                         nameIOExceptionImportUtil.Builderpublic static String importReader(BufferedReader in, Database db, String name, String delim, char quote, ImportFilter filter, boolean useExistingTable) throws IOException
 Equivalent to:
 importReader(in, db, name, delim, '"', filter, useExistingTable, true);
name - Name of the new table to createin - Source reader to importdelim - Regular expression representing the delimiter string.quote - the quote characterfilter - valid import filteruseExistingTable - if true use current table if it already
                         exists, otherwise, create new table with unique
                         nameIOExceptionImportUtil.Builderpublic static String importReader(BufferedReader in, Database db, String name, String delim, char quote, ImportFilter filter, boolean useExistingTable, boolean header) throws IOException
name - Name of the new table to createin - Source reader to importdelim - Regular expression representing the delimiter string.quote - the quote characterfilter - valid import filteruseExistingTable - if true use current table if it already
                         exists, otherwise, create new table with unique
                         nameheader - if false the first line is not a header row, only
               valid if useExistingTable is trueIOExceptionImportUtil.BuilderCopyright © 2005–2025 OpenHMS. All rights reserved.