borland Packages Class Hierarchy dx.dataset Package
java.lang.Object +----com.borland.dx.dataset.DataFile +----com.borland.dx.dataset.TextDataFile
Constructors Properties Methods
Implements Designable, LoadCancel, Serializable
The TextDataFile
component specifies the properties of a text file that affect its import and export, such as delimiters, field separators, and so on. This component is used when:
TableDataSet
component
StorageDataSet
to a text file
When importing data into a TableDataSet
, this component specifies the properties of the text file that affect its import, such as delimiters, field separators, and so on. To further specify the formatting of the data within each field, set the
exportDisplayMask
property of the Column
component. The exportDisplayMask
is used both when importing as well as exporting.
This component is the default for the dataFile
property of the StorageDataSet
component. By default, exported data is in a text format
as specified by this component's properties. To write the data stored in any StorageDataSet
to a text file, instantiate a TextDataFile
component and call one of the TextDataFile.save(...)
methods.
All properties of this component have default values. To changes these values, call the corresponding accessor methods. In addition, localized properties are stored in its associated DataFileFormat
object, which is set by this component's fileFormat
property.
For information on saving data stored in a TableDataSet
using this component, see "Saving data in a TextDataFile
to a JDBC data source" in the About section of the TableDataSet
component, or "Retrieving data from a data source" and "Importing and exporting data from a text file" in the Database Application Developer's Guide.
public TextDataFile()Constructs a
TextDataFile
component.
public final String getDelimiter() public final void setDelimiter(String delimiter)The
String
character that appears before and after character data elements in the data file. The default value is double-quotes (").
public final String getEncoding() public final void setEncoding(String encoding)The encoding of the file. Based on the encoding returned by
System.getProperty("file.encoding")
, this property sets the fileFormat
property to ASCII
or ENCODED
.
public final int getFileFormat() public final void setFileFormat(int fileFormat)The format of the file-based data source. This property defaults to
ASCII
. Valid values for encoding
are defined in DataFileFormat
.
public String getFileName() public void setFileName(String fileName)Stores the name of the file that contains data to read in or to write out to. This property defaults to TextDataFile.txt.
public final boolean isLoadAsInserted() public final void setLoadAsInserted(boolean loadAsInserted)Determines whether to load rows with a
RowStatus
of RowStatus.INSERTED
(true) or, to load rows with a RowStatus
of RowStatus.LOADED
(false). If set to true
these rows are treated as inserted when methods such as Database.saveChanges()
are called.
public boolean isLoadOnOpen() public void setLoadOnOpen(boolean loadOnOpen)If true, then the
DataSet
is loaded with the contents of the file when the DataSet
is opened.
public final Locale getLocale() public final void setLocale(Locale locale)Specifies the
Locale
of the TextDataFile
component. The locale
property allows the user to identify which locale to use when formatting the data in a Column
. This property supports locales that are supported by the JavaSoft (tm) JDK.
public final String getSeparator() public final void setSeparator(String separator)Specifies the value used to separated individual data items. The default value for this property is the tab character (\t).
public final void load(DataSet dataSet)Loads data from a stream into the
DataSet
.
public final void load(DataSet dataSet, InputStream stream, InputStream schemaStream)Loads data from the input stream into the specified
DataSet
. The schemaStream
parameter
can be set to null if columns have already been added to the DataSet
.
public final void loadMetaData(DataSet dataSet)Loads metadata into the
DataSet
using the schema file specified by the fileName
property.
public void save(DataSet saveDataSet)Saves
DataSet
data to the file specified by the fileName
property.
public void save(DataSet saveDataSet, OutputStream stream, OutputStream schemaStream)Saves the
DataSet
data and metadata as specified.
saveDataSet
DataSet
containing the data to save.
stream
DataSet
.
schemaStream
DataSet's
metadata. If this parameter is null, the
fileName
property is used to save the metadata.