[OpenMap Users] Fix for nulls in column names in ESRI Tiger dbf files.

From: Cary O'Brien <cobrien_at_cornet.com>
Date: Fri, 12 Aug 2005 09:33:49 -0400

We had a problem with null characters in the DBF data that came
with the US Census tiger databases we downloaded from ESRI.
Here is a fix in DbfInputStream.readFieldDescription()

-- cary

---------- com/bbn/openmap/dataAccess/shape/input/DbfInputStream.java
------------

   /**
     * Initializes arrays that hold column names, column types, character
     * lengths, and decimal counts, then populates them
     */
    private void readFieldDescripters() throws IOException {
        _columnNames = new String[_columnCount];
        _types = new byte[_columnCount];
        _lengths = new int[_columnCount];
        _decimalCounts = new byte[_columnCount];
       
        for (int n=0; n<=_columnCount-1; n++) {
            _columnNames[n] = _leis.readString(11);
            //
            // Some TIGER dbf files from ESRI have nulls
            // in the column names. Delete them.
            //
            int ix = _columnNames[n].indexOf((char)0);
            if(ix > 0) {
                _columnNames[n] = _columnNames[n].substring(0,ix);
            }
            _types[n] = (byte)_leis.readByte();
            _leis.skipBytes(4);
            _lengths[n] = _leis.readUnsignedByte();
            _decimalCounts[n] = _leis.readByte();
            _leis.skipBytes(14);
           
        }
    }
   

--
[To unsubscribe to this list send an email to "majdart_at_bbn.com"
with the following text in the BODY of the message "unsubscribe openmap-users"]
Received on Fri Aug 12 2005 - 09:35:59 EDT

This archive was generated by hypermail 2.3.0 : Tue Mar 28 2017 - 23:25:07 EDT