public static GeometryMetaData getMetaDataFromWKB ( byte [ ] bytes ) throws IOException { ByteOrderDataInStream dis = new ByteOrderDataInStream ( ) ; dis . setInStream ( new ByteArrayInStream ( bytes ) ) ; // determine byte order byte byteOrderWKB = dis . readByte ( ) ; // always set byte order, since it may change from geometry to geometry int byteOrder = byteOrderWKB == WKBConstants . wkbNDR ? ByteOrderValues . LITTLE_ENDIAN : ByteOrderValues . BIG_ENDIAN ; dis . setOrder ( byteOrder ) ; int typeInt = dis . readInt ( ) ; int geometryType = typeInt & 0xff ; // determine if Z values are present boolean hasZ = ( typeInt & 0x80000000 ) != 0 ; int inputDimension = hasZ ? 3 : 2 ; // determine if SRIDs are present boolean hasSRID = ( typeInt & 0x20000000 ) != 0 ; int SRID = 0 ; if ( hasSRID ) { SRID = dis . readInt ( ) ; } return new GeometryMetaData ( inputDimension , hasSRID , hasZ , geometryType , SRID ) ; }
Read the first bytes of Geometry WKB .