Class: DBaseFile

DBaseFile(url)

Parses a dBase file.

Constructor

new DBaseFile(url)

Constructs an object for dBase file at a specified URL. Applications typically do not call this constructor. It is called by {Shapefile to read attributes for shapes.
Parameters:
Name Type Description
url String The location of the dBase file.
Source:
Throws:
If the specified URL is null or undefined.
Type
ArgumentError

Members

(static) FIELD_DESCRIPTOR_LENGTH :Number

The length of a dBase file field descriptor.
Type:
  • Number
Source:

(static) FIXED_HEADER_LENGTH :Number

The length of a dBase file header.
Type:
  • Number
Source:

Methods

(static) isStringFilled(string, fillValue) → {Boolean}

Indicates if the string is filled with constant data of a particular kind.
Parameters:
Name Type Description
string String The string of characters.
fillValue Number The character value to test.
Source:
Returns:
True if the character array is filled with the specified value.
Type
Boolean

getFields() → {Array.<DBaseField>}

The field descriptors of the dBase file.
Source:
Returns:
The field descriptors.
Type
Array.<DBaseField>

getHeaderLength() → {Number}

The length of the header of the dBase file.
Source:
Returns:
The length of the header.
Type
Number

getLastModificationDate() → {String}

The modification date of the the dBase file.
Source:
Returns:
The modification date.
Type
String

getNumberOfFields() → {Number}

The number of fields in a dBase file.
Source:
Returns:
The number of fields.
Type
Number

getNumberOfRecords() → {Number}

The number of records in the dBase file.
Source:
Returns:
The number of records.
Type
Number

getRecordLength() → {Number}

The length of a record in the dBase file.
Source:
Returns:
The lenght of a recrod.
Type
Number

hasNext() → {Boolean}

Indicates whether the dBase file has additional records to read.
Source:
Returns:
True if more records can be read.
Type
Boolean

isStringEmpty(string) → {Boolean}

Indicate whether the string is "logically" empty in the dBase sense.
Parameters:
Name Type Description
string String The string of characters.
Source:
Returns:
True if the string is logically empty.
Type
Boolean

load(completionCallback)

Initiate loading of the dBase file.
Parameters:
Name Type Description
completionCallback
Source:

nextRecord() → {DBaseRecord}

Read the next record in the dBase file.
Source:
Returns:
The next record.
Type
DBaseRecord

parse()

Parse the dBase file.
Source:

readFieldDescriptors(buffer, numFields) → {Array.<DBaseField>}

Reads a sequence of DBaseField descriptors from the given buffer;

The buffer current position is assumed to be set at the start of the sequence and will be set to the end of the sequence after this method has completed.

Parameters:
Name Type Description
buffer ByteBuffer A byte buffer descriptor to read from.
numFields Number The number of DBaseFields to read.
Source:
Returns:
An array of DBaseField instances.
Type
Array.<DBaseField>

readHeader(buffer) → {Object}

Read the header of the dBase file.
Parameters:
Name Type Description
buffer ByteBuffer The buffer descriptor to read from.
Source:
Returns:
Type
Object

readNextRecord(buffer, recordNumber) → {DBaseRecord}

Reads a DBaseRecord instance from the given buffer;

The buffer current position is assumed to be set at the start of the record and will be set to the start of the next record after this method has completed.

Parameters:
Name Type Description
buffer ByteBuffer The buffer descriptor to read from.
recordNumber Number The record's sequence number.
Source:
Returns:
A DBaseRecord instance.
Type
DBaseRecord

readNullTerminatedString(buffer, maxLength) → {String}

Read a null-terminated string.
Parameters:
Name Type Description
buffer ByteBuffer A buffer descriptor to read from.
maxLength Number The number of maximum characters.
Source:
Returns:
Type
String

requestUrl(url)

Internal use only. Request data from the URL.
Parameters:
Name Type Description
url String The URL for the requested data.
Source: