Class DbaseFileWriter
java.lang.Object
org.gvsig.fmap.dal.store.dbf.utils.DbaseFileWriter
A DbaseFileReader is used to read a dbase III format file. The general use of
this class is:
DbaseFileHeader header = ...
WritableFileChannel out = new FileOutputStream("thefile.dbf").getChannel();
DbaseFileWriter w = new DbaseFileWriter(header,out);
while ( moreRecords ) {
w.write( getMyRecord() );
}
w.close();
You must supply the moreRecords and
getMyRecord() logic...- Author:
- Ian Schneider
-
Constructor Summary
ConstructorsConstructorDescriptionDbaseFileWriter(DbaseFileHeader header, FileChannel out, boolean isNew) Create a DbaseFileWriter using the specified header and writing to the given channel. -
Method Summary
Modifier and TypeMethodDescriptionvoidappend(org.gvsig.fmap.dal.feature.Feature feature) Write a single dbase record.voidclose()Release resources associated with this writer.protected org.gvsig.tools.logger.FilteredLoggervoidsetCharset(Charset charset) voidupdate(org.gvsig.fmap.dal.feature.Feature feature, long numReg) Write a single dbase record.
-
Constructor Details
-
DbaseFileWriter
public DbaseFileWriter(DbaseFileHeader header, FileChannel out, boolean isNew) throws org.gvsig.fmap.dal.exception.InitializeException Create a DbaseFileWriter using the specified header and writing to the given channel.- Parameters:
header- The DbaseFileHeader to write.out- The Channel to write to.- Throws:
org.gvsig.fmap.dal.exception.InitializeException
-
-
Method Details
-
append
public void append(org.gvsig.fmap.dal.feature.Feature feature) throws org.gvsig.fmap.dal.exception.WriteException, org.gvsig.fmap.dal.exception.UnsupportedEncodingException Write a single dbase record.- Throws:
org.gvsig.fmap.dal.exception.WriteExceptionorg.gvsig.fmap.dal.exception.UnsupportedEncodingException
-
update
public void update(org.gvsig.fmap.dal.feature.Feature feature, long numReg) throws org.gvsig.fmap.dal.exception.WriteException, org.gvsig.fmap.dal.exception.UnsupportedEncodingException Write a single dbase record. Useful to update a dbf.- Throws:
org.gvsig.fmap.dal.exception.WriteExceptionorg.gvsig.fmap.dal.exception.UnsupportedEncodingException
-
close
public void close() throws org.gvsig.fmap.dal.exception.CloseExceptionRelease resources associated with this writer. Highly recommended- Throws:
org.gvsig.fmap.dal.exception.CloseException
-
setCharset
-
getLogger
protected org.gvsig.tools.logger.FilteredLogger getLogger()
-