/**
   * Constructs a DBFHeader, read the data from file <br>
   * You need to supply an open file handle to read from
   *
   * @param ff open file handle for read access
   */
  DBFHeader(RandomAccessFile ff) throws tinySQLException {
    try {
      ff.seek(FLAG_INDEX);
      file_type = Utils.fixByte(ff.readByte());

      // get the last update date
      file_update_year = Utils.fixByte(ff.readByte());
      file_update_month = Utils.fixByte(ff.readByte());
      file_update_day = Utils.fixByte(ff.readByte());

      // a byte array to hold little-endian long data
      //
      byte[] b = new byte[4];

      // read that baby in...
      //
      ff.readFully(b);

      // convert the byte array into a long (really a double)
      // 4-7 number of records
      numRecords = (int) Utils.vax_to_long(b);

      // a byte array to hold little-endian short data
      //
      b = new byte[2];

      // get the data position (where it starts in the file)
      // 8-9 Length of header
      ff.readFully(b);
      headerLength = Utils.vax_to_short(b);

      // find out the length of the data portion
      // 10-11 Length of Record
      ff.readFully(b);
      recordLength = Utils.vax_to_short(b);

      // calculate the number of fields
      //
      numFields = (headerLength - 33) / 32;

      // skip the next 20 bytes - looks like this is not needed...
      // ff.skipBytes(20);
      // 12-31 reserved

      Utils.log("HEADER=" + this.toString());

    } catch (Exception e) {
      throw new tinySQLException(e.getMessage());
    }
  }