Search in sources :

Example 1 with ResourceEndianOutput

use of com.revolsys.io.endian.ResourceEndianOutput in project com.revolsys.open by revolsys.

the class ShapefileRecordWriter method init.

@Override
protected void init() throws IOException {
    super.init();
    final RecordDefinitionImpl recordDefinition = (RecordDefinitionImpl) getRecordDefinition();
    if (recordDefinition != null) {
        this.geometryFieldName = recordDefinition.getGeometryFieldName();
        if (this.geometryFieldName != null) {
            this.out = new ResourceEndianOutput(this.resource);
            writeHeader(this.out);
            if (!hasField(this.geometryFieldName)) {
                addFieldDefinition(this.geometryFieldName, XBaseFieldDefinition.OBJECT_TYPE, 0, 0);
            }
            final Resource indexResource = this.resource.newResourceChangeExtension("shx");
            if (indexResource != null) {
                this.indexOut = new ResourceEndianOutput(indexResource);
                writeHeader(this.indexOut);
            }
            this.geometryFactory = getProperty(IoConstants.GEOMETRY_FACTORY);
            final Object geometryType = getProperty(IoConstants.GEOMETRY_TYPE);
            if (geometryType != null) {
                this.geometryDataType = DataTypes.getDataType(geometryType.toString());
            }
        }
    }
}
Also used : ResourceEndianOutput(com.revolsys.io.endian.ResourceEndianOutput) Resource(com.revolsys.spring.resource.Resource) RecordDefinitionImpl(com.revolsys.record.schema.RecordDefinitionImpl)

Aggregations

ResourceEndianOutput (com.revolsys.io.endian.ResourceEndianOutput)1 RecordDefinitionImpl (com.revolsys.record.schema.RecordDefinitionImpl)1 Resource (com.revolsys.spring.resource.Resource)1