byte endian = data.getByte(); if (endian != data.endian) { throw new IllegalArgumentException("Endian inconsistency!"); } int typeword = data.getInt();  int realtype = typeword & 0x1FFFFFFF;  boolean haveZ = (typeword & 0x80000000) != 0; boolean haveM = (typeword & 0x40000000) != 0; boolean haveS = (typeword & 0x20000000) != 0;  int srid = -1;  if (haveS) { srid = data.getInt(); }  Geometry result1; switch (realtype) { case org.postgis.Geometry.POINT : result1 = parsePoint(data, haveZ, haveM); break; case org.postgis.Geometry.LINESTRING : result1 = parseLineString(data, haveZ, haveM); break; case org.postgis.Geometry.POLYGON : result1 = parsePolygon(data, haveZ, haveM); break; case org.postgis.Geometry.MULTIPOINT : result1 = parseMultiPoint(data); break; case org.postgis.Geometry.MULTILINESTRING : result1 = parseMultiLineString(data); break; case org.postgis.Geometry.MULTIPOLYGON : result1 = parseMultiPolygon(data); break; case org.postgis.Geometry.GEOMETRYCOLLECTION : result1 = parseCollection(data); break; default : throw new IllegalArgumentException("Unknown Geometry Type!"); }  Geometry result = result1;  if (haveS) { result.setSRID(srid); } return result;
return parseGeometry(data, null);
    protected Geometry parseGeometry(ValueGetter data) {        byte endian = data.getByte(); // skip and test endian flag        if (endian != data.endian) {            throw new IllegalArgumentException("Endian inconsistency!");        }        int typeword = data.getInt();        int realtype = typeword & 0x1FFFFFFF; // cut off high flag bits        boolean haveZ = (typeword & 0x80000000) != 0;        boolean haveM = (typeword & 0x40000000) != 0;        boolean haveS = (typeword & 0x20000000) != 0;        int srid = -1;        if (haveS) {            srid = data.getInt();        }                Geometry result1;        switch (realtype) {        case org.postgis.Geometry.POINT :            result1 = parsePoint(data, haveZ, haveM);            break;        case org.postgis.Geometry.LINESTRING :            result1 = parseLineString(data, haveZ, haveM);            break;        case org.postgis.Geometry.POLYGON :            result1 = parsePolygon(data, haveZ, haveM);            break;        case org.postgis.Geometry.MULTIPOINT :            result1 = parseMultiPoint(data);            break;        case org.postgis.Geometry.MULTILINESTRING :            result1 = parseMultiLineString(data);            break;        case org.postgis.Geometry.MULTIPOLYGON :            result1 = parseMultiPolygon(data);            break;        case org.postgis.Geometry.GEOMETRYCOLLECTION :            result1 = parseCollection(data);            break;        default :            throw new IllegalArgumentException("Unknown Geometry Type!");        }        Geometry result = result1;        if (haveS) {            result.setSRID(srid);        }        return result;    }