Package org.postgis.jts
Class JtsBinaryParser
- java.lang.Object
-
- org.postgis.jts.JtsBinaryParser
-
public class JtsBinaryParser extends Object
Parse binary representation of geometries. Currently, only text rep (hexed) implementation is tested. It should be easy to add char[] and CharSequence ByteGetter instances, although the latter one is not compatible with older jdks. I did not implement real unsigned 32-bit integers or emulate them with long, as both java Arrays and Strings currently can have only 2^31-1 elements (bytes), so we cannot even get or build Geometries with more than approx. 2^28 coordinates (8 bytes each).- Author:
- Markus Schaber, [email protected]
-
-
Constructor Summary
Constructors Constructor Description JtsBinaryParser()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description org.locationtech.jts.geom.Geometryparse(byte[] value)Parse a binary encoded geometry.org.locationtech.jts.geom.Geometryparse(String value)Parse a hex encoded geometryprotected org.locationtech.jts.geom.GeometryparseGeometry(org.postgis.binary.ValueGetter data)Parse a geometry starting at offset.protected org.locationtech.jts.geom.GeometryparseGeometry(org.postgis.binary.ValueGetter data, int srid, boolean inheritSrid)Parse with a known geometry factorystatic org.postgis.binary.ValueGettervalueGetterForEndian(org.postgis.binary.ByteGetter bytes)Get the appropriate ValueGetter for my endianness
-
-
-
Method Detail
-
valueGetterForEndian
public static org.postgis.binary.ValueGetter valueGetterForEndian(org.postgis.binary.ByteGetter bytes)
Get the appropriate ValueGetter for my endianness- Parameters:
bytes- The appropriate Byte Getter- Returns:
- the ValueGetter
-
parse
public org.locationtech.jts.geom.Geometry parse(String value)
Parse a hex encoded geometry- Parameters:
value- String containing the hex data to be parsed- Returns:
- the resulting parsed geometry
-
parse
public org.locationtech.jts.geom.Geometry parse(byte[] value)
Parse a binary encoded geometry.- Parameters:
value- byte array containing the binary encoded geometru- Returns:
- the resulting parsed geometry
-
parseGeometry
protected org.locationtech.jts.geom.Geometry parseGeometry(org.postgis.binary.ValueGetter data)
Parse a geometry starting at offset.- Parameters:
data- ValueGetter for the data to be parsed- Returns:
- The resulting Geometry
-
parseGeometry
protected org.locationtech.jts.geom.Geometry parseGeometry(org.postgis.binary.ValueGetter data, int srid, boolean inheritSrid)Parse with a known geometry factory- Parameters:
data- ValueGetter for the data to be parsedsrid- the SRID to be used for parsinginheritSrid- flag to toggle inheriting SRIDs- Returns:
- The resulting Geometry
-
-