If you have any questions or suggestions please do not hesitate to ask me by ask@smart-flex.ru.
public class
Fp26Reader {
private static void testRead() {
DbfIterator dbfIterator = DbfEngine.getReader(
Fp26Reader.class.getResourceAsStream("FP_26_SAMPLE.DBF"), null);
while
(dbfIterator.hasMoreRecords()) {
DbfRecord dbfRecord =
dbfIterator.nextRecord();
String string = dbfRecord.getString("string");
float sumFloat =
dbfRecord.getFloat("sum_f");
BigDecimal sumNumeric =
dbfRecord.getBigDecimal("sum_n");
boolean bool =
dbfRecord.getBoolean("bool_val");
Date date = dbfRecord.getDate("date_val");
System.out.println(string + " " + sumFloat + " " +
sumNumeric + " "
+
bool + " " + date);
}
}
public static void main(String[]
args) {
Fp26Reader.testRead();
}
}
public class
Fp26Writer {
private static void testWrite() {
DbfAppender dbfAppender = DbfEngine.getWriter("WRT_PERSON.DBF", DbfCodePages.Cp866);
DbfColumn dc01 = new DbfColumn("magic", DbfColumnTypes.Logical, 0, 0);
DbfColumn dc02 = new DbfColumn("actor", DbfColumnTypes.Character, 60, 0);
DbfColumn dc03 = new DbfColumn("currdate", DbfColumnTypes.Date, 0, 0);
DbfColumn dc04 = new DbfColumn("hit", DbfColumnTypes.Numeric, 10, 2);
DbfColumn dc05 = new DbfColumn("forever", DbfColumnTypes.Logical, 0, 0);
dbfAppender.defineColumns(dc01,dc02, dc03,
dc04, dc05);
DbfStatement statement =
dbfAppender.getStatement();
statement.setString("actor", "Chuck Norris");
statement.setDate("currdate", new Date());
statement.setBigDecimal("hit", new BigDecimal("500.5"));
statement.insertStatement();
statement.setBoolean("magic", Boolean.TRUE);
statement.setString("actor", "Bruce Lee");
statement.setBigDecimal("hit", new BigDecimal("1000.10"));
statement.setBoolean("forever", Boolean.TRUE);
statement.insertStatement();
dbfAppender.writeDbfAndClose();
}
public static void main(String[]
args) {
Fp26Writer.testWrite();
}
}
РКЦ-флекс
работает с 1995 года