if (checkSrid(geom)) {
if (haveSrid) {
    protected void writeGeometry(Geometry geom, ValueSetter dest) {        final int dimension = getCoordDim(geom);        if (dimension < 2 || dimension > 4) {            throw new IllegalArgumentException("Unsupported geometry dimensionality: " + dimension);        }        // write endian flag        dest.setByte(dest.endian);        // write typeword        final int plaintype = getWKBType(geom);        int typeword = plaintype;        if (dimension == 3 || dimension == 4) {            typeword |= 0x80000000;        }        if (dimension == 4) {            typeword |= 0x40000000;        }        if (checkSrid(geom)) {            typeword |= 0x20000000;        }        dest.setInt(typeword);        if (checkSrid(geom)) {            dest.setInt(geom.getSRID());        }        switch (plaintype) {        case org.postgis.Geometry.POINT:            writePoint((Point) geom, dest);            break;        case org.postgis.Geometry.LINESTRING:            writeLineString((LineString) geom, dest);            break;        case org.postgis.Geometry.POLYGON:            writePolygon((Polygon) geom, dest);            break;        case org.postgis.Geometry.MULTIPOINT:            writeMultiPoint((MultiPoint) geom, dest);            break;        case org.postgis.Geometry.MULTILINESTRING:            writeMultiLineString((MultiLineString) geom, dest);            break;        case org.postgis.Geometry.MULTIPOLYGON:            writeMultiPolygon((MultiPolygon) geom, dest);            break;        case org.postgis.Geometry.GEOMETRYCOLLECTION:            writeCollection((GeometryCollection) geom, dest);            break;        default:            throw new IllegalArgumentException("Unknown Geometry Type: " + plaintype);        }    }