public class IlvDBFReader extends Object
.dbf
extension. The .dbf
files contain
the attributes of the map objects. This reader can be used as
an iterator on a .dbf
file. It can also be used
to directly access the records in the file (or more precisely their index)
if it was created with the constructor that takes a file name as argument.
IlvShapeFileReader
Constructor and Description |
---|
IlvDBFReader(DataInput dataInput)
Creates an instance of
IlvDBFReader
from a data input. |
IlvDBFReader(String fileName)
Creates an instance of
IlvDBFReader
for the specified file name. |
IlvDBFReader(URL url)
Creates an instance of
IlvDBFReader for the specified URL. |
Modifier and Type | Method and Description |
---|---|
void |
dispose()
Releases the resources allocated to the reader.
|
void |
finalize()
Is called by the Java Garbage Collector to release
the resources allocated to the reader.
|
IlvAttributeInfoProperty |
getAttributeInfo()
Returns the types and names of the fields contained in the
.dbf file. |
int |
getAttributeSize(int index)
Return the size of the attribute specified by the index.
|
int |
getCurrentIndex()
Returns the index of the next field that will be read.
|
IlvFeatureAttributeProperty |
getNextRecord()
Reads the next record in the
.dbf file. |
int |
getRecordCount()
Returns the number of records contained in the
.dbf file. |
String |
getStringEncoding()
Returns the character encoding used when reading attributes.
|
boolean |
isInterningStringAttributes()
Returns
true if the String attributes that are read are
interned. |
boolean |
isReadingAttribute(int index)
Returns
true if the specified attribute is read. |
boolean |
isReadingAttribute(String name)
Returns
true if the specified attribute is read. |
boolean |
isTrimmingStringAttributes()
Returns
true if the String attributes that are read are
trimmed, that is, leading and trailing spaces are removed. |
IlvFeatureAttributeProperty |
readRecord(int index)
Reads the record corresponding to the specified index (see restrictions below).
|
void |
setInterningStringAttributes(boolean set)
Specifies whether the String attributes that are read are
interned.
|
void |
setReadingAttribute(int index,
boolean set)
Tells the reader whether to read the attribute whose index is specified.
|
void |
setReadingAttribute(String name,
boolean set)
Tells the reader whether to read the attribute whose name is specified.
|
void |
setStringEncoding(String encoding)
Specifies which character encoding is used when reading attributes.
|
void |
setTrimmingStringAttributes(boolean set)
Specifies whether the String attributes that are read are trimmed,
that is, leading and trailing spaces are removed.
|
public IlvDBFReader(String fileName) throws IOException
IlvDBFReader
for the specified file name.fileName
- The name of the DBF fileIOException
- if the file cannot be opened.public IlvDBFReader(URL url) throws IOException
IlvDBFReader
for the specified URL.url
- The url of the DBF file (with the .dbf
extension)IOException
- if an error occurs while opening the file.public IlvDBFReader(DataInput dataInput) throws IOException
IlvDBFReader
from a data input.dataInput
- the data input.IOException
- if the file cannot be opened.public void setTrimmingStringAttributes(boolean set)
set
- If true
, String attributes are trimmed.public boolean isTrimmingStringAttributes()
true
if the String attributes that are read are
trimmed, that is, leading and trailing spaces are removed.
The default is false
.public void setInterningStringAttributes(boolean set)
isInterningStringAttributes()
,
String.intern()
public boolean isInterningStringAttributes()
true
if the String attributes that are read are
interned. The default is false
.setInterningStringAttributes(boolean)
public void setStringEncoding(String encoding)
encoding
- The String encoding or null
to read the
attributes using the default encoding of the platform.public String getStringEncoding()
null
if
using the default encoding of the platform.public void setReadingAttribute(String name, boolean set)
name
- The name of the attribute.set
- If true
, the specified attribute is read.public boolean isReadingAttribute(String name)
true
if the specified attribute is read.name
- The name of the attribute.public void setReadingAttribute(int index, boolean set)
index
- The index of the attribute.set
- If true
, the specified attribute is read.public boolean isReadingAttribute(int index)
true
if the specified attribute is read.index
- The index of the attribute.public final int getRecordCount()
.dbf
file.public final IlvAttributeInfoProperty getAttributeInfo()
.dbf
file.
Each record has the same fields.public int getAttributeSize(int index)
index
- The index of the attribute.public int getCurrentIndex()
public IlvFeatureAttributeProperty getNextRecord() throws IOException
.dbf
file.
The returned attribute value is volatile and might be modified
when the getNextRecord
method is called again.IOException
- if the end of the file is reached or
if an IO exception is thrown.getCurrentIndex()
public IlvFeatureAttributeProperty readRecord(int index) throws IOException
IlvShapeFileReader
.
IOException
- if the end of the file is reached or
if an IO exception is thrown.public void dispose()
© Copyright Rogue Wave Software, Inc. 1997, 2018. All Rights Reserved.