Revision 1848 branches/Fmap_GisPlanet/libraries/libFMap/src/com/iver/cit/gvsig/fmap/drivers/shp/DbaseFileHeaderNIO.java
DbaseFileHeaderNIO.java | ||
---|---|---|
62 | 62 |
*/ |
63 | 63 |
package com.iver.cit.gvsig.fmap.drivers.shp; |
64 | 64 |
|
65 |
import com.hardcode.gdbms.engine.data.DriverException; |
|
66 |
import com.hardcode.gdbms.engine.instruction.SemanticException; |
|
67 |
import com.hardcode.gdbms.engine.values.Value; |
|
68 |
|
|
69 |
import com.iver.cit.gvsig.fmap.layers.SelectableDataSource; |
|
70 |
|
|
71 |
import com.vividsolutions.jts.geom.Geometry; |
|
72 |
|
|
73 | 65 |
import java.io.EOFException; |
74 | 66 |
import java.io.IOException; |
75 |
|
|
76 | 67 |
import java.nio.ByteBuffer; |
77 | 68 |
import java.nio.ByteOrder; |
78 | 69 |
import java.nio.channels.ReadableByteChannel; |
79 | 70 |
import java.nio.channels.WritableByteChannel; |
80 |
|
|
71 |
import java.sql.Types; |
|
81 | 72 |
import java.util.Calendar; |
82 | 73 |
import java.util.Date; |
83 | 74 |
import java.util.logging.Level; |
84 | 75 |
import java.util.logging.Logger; |
85 | 76 |
|
77 |
import com.hardcode.gdbms.engine.data.driver.DriverException; |
|
78 |
import com.iver.cit.gvsig.fmap.layers.SelectableDataSource; |
|
79 |
import com.vividsolutions.jts.geom.Geometry; |
|
86 | 80 |
|
81 |
|
|
87 | 82 |
/** |
88 | 83 |
* Class to represent the header of a Dbase III file. Creation date: (5/15/2001 |
89 | 84 |
* 5:15:30 PM) |
... | ... | |
771 | 766 |
try { |
772 | 767 |
for (int i = 0, ii = sds.getFieldCount(); i < ii; i++) { |
773 | 768 |
|
774 |
Class type = sds.getFieldType(i);
|
|
769 |
int type = sds.getFieldType(i);
|
|
775 | 770 |
String colName = sds.getFieldName(i); |
776 | 771 |
|
777 | 772 |
///int fieldLen = ((DBFDriver)sds.getDriver()).getFieldLength(i); |
... | ... | |
782 | 777 |
// fieldLen = 255; |
783 | 778 |
// } |
784 | 779 |
// @todo respect field length |
785 |
if ((type == Value.DOUBLE) ||
|
|
786 |
(type == Value.FLOAT) ||
|
|
787 |
(type == Value.INTEGER))
|
|
780 |
if ((type == Types.DOUBLE) ||
|
|
781 |
(type == Types.FLOAT) ||
|
|
782 |
(type == Types.INTEGER))
|
|
788 | 783 |
|
789 | 784 |
header.addColumn(colName, 'N', Math.min(fieldLen, 10), |
790 | 785 |
decimales); |
791 |
if (type == Value.DATE)
|
|
786 |
if (type == Types.DATE)
|
|
792 | 787 |
header.addColumn(colName, 'D', fieldLen, 0); |
793 |
if (type == Value.BIT)
|
|
788 |
if (type == Types.BIT)
|
|
794 | 789 |
header.addColumn(colName, 'L', 1, 0); |
795 |
if ((type == Value.VARCHAR) ||
|
|
796 |
(type == Value.CHAR) ||
|
|
797 |
(type == Value.LONGVARCHAR))
|
|
790 |
if ((type == Types.VARCHAR) ||
|
|
791 |
(type == Types.CHAR) ||
|
|
792 |
(type == Types.LONGVARCHAR))
|
|
798 | 793 |
header.addColumn(colName, 'C', Math.min(254, fieldLen), |
799 | 794 |
0); |
800 | 795 |
} |
Also available in: Unified diff