|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.healthmarketscience.jackcess.util.ExportUtil
public class ExportUtil
Utility class for exporting tables from an Access database to other
formats. See the ExportUtil.Builder for convenient configuration of the
export functionality. Note that most scenarios for customizing output data
can be handled by implementing a custom ExportFilter.
| Nested Class Summary | |
|---|---|
static class |
ExportUtil.Builder
Builder which simplifies configuration of an export operation. |
| Field Summary | |
|---|---|
static String |
DEFAULT_DELIMITER
|
static String |
DEFAULT_FILE_EXT
|
static char |
DEFAULT_QUOTE_CHAR
|
| Method Summary | |
|---|---|
static void |
exportAll(Database db,
File dir)
Copy all tables into new delimited text files Equivalent to: exportAll(db, dir, "csv"); |
static void |
exportAll(Database db,
File dir,
String ext)
Copy all tables into new delimited text files Equivalent to: exportFile(db, name, f, false, null, '"',
SimpleExportFilter.INSTANCE); |
static void |
exportAll(Database db,
File dir,
String ext,
boolean header)
Copy all tables into new delimited text files Equivalent to: exportFile(db, name, f, false, null, '"',
SimpleExportFilter.INSTANCE); |
static void |
exportAll(Database db,
File dir,
String ext,
boolean header,
String delim,
char quote,
ExportFilter filter)
Copy all tables into new delimited text files Equivalent to: exportFile(db, name, f, false, null, '"',
SimpleExportFilter.INSTANCE); |
static void |
exportFile(Database db,
String tableName,
File f)
Copy a table into a new delimited text file Equivalent to: exportFile(db, name, f, false, null, '"',
SimpleExportFilter.INSTANCE); |
static void |
exportFile(Database db,
String tableName,
File f,
boolean header,
String delim,
char quote,
ExportFilter filter)
Copy a table into a new delimited text file Nearly equivalent to: exportWriter(db, name, new BufferedWriter(f),
header, delim, quote, filter); |
static void |
exportWriter(Cursor cursor,
BufferedWriter out,
boolean header,
String delim,
char quote,
ExportFilter filter)
Copy a table in this database into a new delimited text file. |
static void |
exportWriter(Database db,
String tableName,
BufferedWriter out)
Copy a table in this database into a new delimited text file Equivalent to: exportWriter(db, name, out, false, null, '"',
SimpleExportFilter.INSTANCE); |
static void |
exportWriter(Database db,
String tableName,
BufferedWriter out,
boolean header,
String delim,
char quote,
ExportFilter filter)
Copy a table in this database into a new delimited text file. |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final String DEFAULT_DELIMITER
public static final char DEFAULT_QUOTE_CHAR
public static final String DEFAULT_FILE_EXT
| Method Detail |
|---|
public static void exportAll(Database db,
File dir)
throws IOException
exportAll(db, dir, "csv");
db - Database the table to export belongs todir - The directory where the new files will be created
IOExceptionexportAll(Database,File,String),
ExportUtil.Builder
public static void exportAll(Database db,
File dir,
String ext)
throws IOException
exportFile(db, name, f, false, null, '"',
SimpleExportFilter.INSTANCE);
db - Database the table to export belongs todir - The directory where the new files will be createdext - The file extension of the new files
IOExceptionexportFile(Database,String,File,boolean,String,char,ExportFilter),
ExportUtil.Builder
public static void exportAll(Database db,
File dir,
String ext,
boolean header)
throws IOException
exportFile(db, name, f, false, null, '"',
SimpleExportFilter.INSTANCE);
db - Database the table to export belongs todir - The directory where the new files will be createdext - The file extension of the new filesheader - If true the first line contains the column names
IOExceptionexportFile(Database,String,File,boolean,String,char,ExportFilter),
ExportUtil.Builder
public static void exportAll(Database db,
File dir,
String ext,
boolean header,
String delim,
char quote,
ExportFilter filter)
throws IOException
exportFile(db, name, f, false, null, '"',
SimpleExportFilter.INSTANCE);
db - Database the table to export belongs todir - The directory where the new files will be createdext - The file extension of the new filesheader - If true the first line contains the column namesdelim - The column delimiter, null for default (comma)quote - The quote characterfilter - valid export filter
IOExceptionexportFile(Database,String,File,boolean,String,char,ExportFilter),
ExportUtil.Builder
public static void exportFile(Database db,
String tableName,
File f)
throws IOException
exportFile(db, name, f, false, null, '"',
SimpleExportFilter.INSTANCE);
db - Database the table to export belongs totableName - Name of the table to exportf - New file to create
IOExceptionexportFile(Database,String,File,boolean,String,char,ExportFilter),
ExportUtil.Builder
public static void exportFile(Database db,
String tableName,
File f,
boolean header,
String delim,
char quote,
ExportFilter filter)
throws IOException
exportWriter(db, name, new BufferedWriter(f),
header, delim, quote, filter);
db - Database the table to export belongs totableName - Name of the table to exportf - New file to createheader - If true the first line contains the column namesdelim - The column delimiter, null for default (comma)quote - The quote characterfilter - valid export filter
IOExceptionexportWriter(Database,String,BufferedWriter,boolean,String,char,ExportFilter),
ExportUtil.Builder
public static void exportWriter(Database db,
String tableName,
BufferedWriter out)
throws IOException
exportWriter(db, name, out, false, null, '"',
SimpleExportFilter.INSTANCE);
db - Database the table to export belongs totableName - Name of the table to exportout - Writer to export to
IOExceptionexportWriter(Database,String,BufferedWriter,boolean,String,char,ExportFilter),
ExportUtil.Builder
public static void exportWriter(Database db,
String tableName,
BufferedWriter out,
boolean header,
String delim,
char quote,
ExportFilter filter)
throws IOException
exportWriter(Cursor.createCursor(db.getTable(tableName)), out, header, delim, quote, filter);
db - Database the table to export belongs totableName - Name of the table to exportout - Writer to export toheader - If true the first line contains the column namesdelim - The column delimiter, null for default (comma)quote - The quote characterfilter - valid export filter
IOExceptionexportWriter(Cursor,BufferedWriter,boolean,String,char,ExportFilter),
ExportUtil.Builder
public static void exportWriter(Cursor cursor,
BufferedWriter out,
boolean header,
String delim,
char quote,
ExportFilter filter)
throws IOException
cursor - Cursor to exportout - Writer to export toheader - If true the first line contains the column namesdelim - The column delimiter, null for default (comma)quote - The quote characterfilter - valid export filter
IOExceptionExportUtil.Builder
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||