Class Dbf

java.lang.Object
org.ka2ddo.util.Dbf

public class Dbf extends Object
This class provides a simple read-only means of interpreting a DBF database file.
Author:
Andrew Pavlin, KA2DDO
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static class 
    This class describes the structure of one field (column) in the DBF table.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    final Dbf.Field[]
    Ordered array of Field definitions for the DBF file.
    Ordered list of records read from the DBF file.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Dbf(File dbfFile)
    Read a DBF file and get all its data into memory.
  • Method Summary

    Modifier and Type
    Method
    Description
    static void
    main(String[] args)
    Unit test method for dumping the contents of a DBF database.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • fields

      public final Dbf.Field[] fields
      Ordered array of Field definitions for the DBF file.
    • records

      public ArrayList<Object[]> records
      Ordered list of records read from the DBF file. Each record is an array of Objects in the order defined by the fields array.
  • Constructor Details

    • Dbf

      public Dbf(File dbfFile) throws IOException
      Read a DBF file and get all its data into memory.
      Parameters:
      dbfFile - File identifying the DBF file in the filesystem
      Throws:
      IOException - if DBF file could not be read for any reason
  • Method Details

    • main

      public static void main(String[] args) throws IOException
      Unit test method for dumping the contents of a DBF database. Arguments are the pathname of the DBF file. Before the file name, the option "-v" can be specified to say that every single record should be dumped, rather than just reporting the DB schema.
      Parameters:
      args - String array of command line parameters
      Throws:
      IOException - if DBF file could not be read for any reason