Revision 21836 branches/Mobile_Compatible_Hito_1/libFMap/src-file/org/gvsig/data/datastores/vectorial/file/dbf/utils/DbaseFileHeader.java
DbaseFileHeader.java | ||
---|---|---|
11 | 11 |
import java.util.Calendar; |
12 | 12 |
import java.util.Date; |
13 | 13 |
|
14 |
import org.gvsig.data.exception.UnsupportedTypeException;
|
|
15 |
import org.gvsig.data.exception.UnsupportedVersionException;
|
|
16 |
import org.gvsig.data.vectorial.IFeatureAttributeDescriptor;
|
|
17 |
import org.gvsig.data.vectorial.IFeatureType;
|
|
14 |
import org.gvsig.data.datastores.vectorial.UnsupportedTypeException;
|
|
15 |
import org.gvsig.data.datastores.vectorial.UnsupportedVersionException;
|
|
16 |
import org.gvsig.data.vectorial.FeatureAttributeDescriptor; |
|
17 |
import org.gvsig.data.vectorial.FeatureType; |
|
18 | 18 |
import org.gvsig.datasources.common.IBigByteBuffer; |
19 | 19 |
import org.gvsig.datasources.common.IByteBuffer; |
20 | 20 |
import org.gvsig.datasources.common.IRandomFileChannel; |
21 | 21 |
import org.gvsig.datasources.impljme.Impl; |
22 | 22 |
|
23 |
//import com.hardcode.gdbms.driver.exceptions.BadFieldDriverException; |
|
24 |
|
|
23 | 25 |
/** |
24 | 26 |
* Class to represent the header of a Dbase III file. Creation date: (5/15/2001 |
25 | 27 |
* 5:15:30 PM) |
... | ... | |
521 | 523 |
return myLanguageID; |
522 | 524 |
} |
523 | 525 |
|
524 |
public static DbaseFileHeader createDbaseHeader(IFeatureType featureType)
|
|
526 |
public static DbaseFileHeader createDbaseHeader(FeatureType featureType) |
|
525 | 527 |
throws UnsupportedTypeException { |
526 | 528 |
DbaseFileHeader header = new DbaseFileHeader(); |
527 | 529 |
|
528 | 530 |
for (int i = 0; i < featureType.size(); i++) { |
529 |
IFeatureAttributeDescriptor descriptor = (IFeatureAttributeDescriptor) featureType
|
|
531 |
FeatureAttributeDescriptor descriptor = (FeatureAttributeDescriptor) featureType
|
|
530 | 532 |
.get(i); |
531 | 533 |
|
532 | 534 |
String type = descriptor.getDataType(); |
... | ... | |
540 | 542 |
// a pi??n. |
541 | 543 |
int decimales = descriptor.getPrecision(); |
542 | 544 |
|
543 |
if (IFeatureAttributeDescriptor.TYPE_DOUBLE == type
|
|
544 |
|| IFeatureAttributeDescriptor.TYPE_FLOAT == type
|
|
545 |
|| IFeatureAttributeDescriptor.TYPE_INT == type
|
|
546 |
|| IFeatureAttributeDescriptor.TYPE_LONG == type) {
|
|
545 |
if (FeatureAttributeDescriptor.TYPE_DOUBLE == type |
|
546 |
|| FeatureAttributeDescriptor.TYPE_FLOAT == type |
|
547 |
|| FeatureAttributeDescriptor.TYPE_INT == type |
|
548 |
|| FeatureAttributeDescriptor.TYPE_LONG == type) { |
|
547 | 549 |
header.addColumn(colName, 'N', Math.min(fieldLen, 18), |
548 | 550 |
decimales); |
549 |
} else if (IFeatureAttributeDescriptor.TYPE_DATE == type) {
|
|
551 |
} else if (FeatureAttributeDescriptor.TYPE_DATE == type) { |
|
550 | 552 |
header.addColumn(colName, 'D', fieldLen, 0); |
551 |
} else if (IFeatureAttributeDescriptor.TYPE_BOOLEAN == type) {
|
|
553 |
} else if (FeatureAttributeDescriptor.TYPE_BOOLEAN == type) { |
|
552 | 554 |
header.addColumn(colName, 'L', 1, 0); |
553 |
} else if (IFeatureAttributeDescriptor.TYPE_STRING == type) {
|
|
555 |
} else if (FeatureAttributeDescriptor.TYPE_STRING == type) { |
|
554 | 556 |
header.addColumn(colName, 'C', Math.min(254, fieldLen), 0); |
555 | 557 |
} |
556 | 558 |
|
Also available in: Unified diff