Class BinaryWriter
java.lang.Object
io.github.sebasbaumh.postgis.binary.BinaryWriter
Create 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:
- [email protected]
-
Method Summary
Modifier and TypeMethodDescriptionstatic byte[]
writeBinary
(Geometry geom) Write a binary encoded geometry.static String
writeHexed
(Geometry geom) Write a hex encoded geometry.
-
Method Details
-
writeBinary
Write a binary encoded geometry. The geometry you put in must be consistent, geom.checkConsistency() must return true. If not, the result may be invalid WKB.- Parameters:
geom
- the geometry to be written- Returns:
- byte arrray containing the encoded geometry
- See Also:
-
writeHexed
Write a hex encoded geometry. The geometry you put in must be consistent, geom.checkConsistency() must return true. If not, the result may be invalid WKB.- Parameters:
geom
- the geometry to be written- Returns:
- String containing the hex encoded geometry
- See Also:
-