コード例 #1
0
 /**
  * Update the header (index 10-11) with the length of one record
  *
  * @param recordLength Length of one data record (row)
  */
 public void setRecordLength(RandomAccessFile ff, int recordLength) throws tinySQLException {
   this.recordLength = recordLength;
   try {
     ff.seek(DBFHeader.LENGTH_OF_REC_INDEX);
     ff.write(Utils.shortToLittleEndian((short) recordLength));
   } catch (Exception e) {
     throw new tinySQLException(e.getMessage());
   }
 }
コード例 #2
0
 /**
  * Update the header (index 8-9) with the new number of records
  *
  * @param numFields number of columns (used to calculate header length)
  */
 public void setHeaderLength(RandomAccessFile ff, int numFields) throws tinySQLException {
   this.numFields = numFields;
   try {
     int headerLength = (DBFHeader.BULK_SIZE + 1) + numFields * DBFHeader.BULK_SIZE;
     ff.seek(DBFHeader.LENGTH_OF_HEADER_INDEX);
     ff.write(Utils.shortToLittleEndian((short) headerLength));
   } catch (Exception e) {
     throw new tinySQLException(e.getMessage());
   }
 }