Package net.postgis.jdbc.geometry.binary
Class BinaryParser
java.lang.Object
net.postgis.jdbc.geometry.binary.BinaryParser
Parse binary representation of geometries.
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 -
Method Summary
Modifier and TypeMethodDescriptionparse(byte[] value) Parse a binary encoded geometry.Parse a hex encoded geometry Is synchronized to protect offset counter.protected GeometryparseGeometry(ValueGetter data) Parse a geometry starting at offset.static ValueGettervalueGetterForEndian(ByteGetter bytes) Get the appropriate ValueGetter for my endianness
-
Constructor Details
-
BinaryParser
public BinaryParser()
-
-
Method Details
-
valueGetterForEndian
Get the appropriate ValueGetter for my endianness- Parameters:
bytes- The appropriate Byte Getter- Returns:
- the ValueGetter
-
parse
Parse a hex encoded geometry Is synchronized to protect offset counter. (Unfortunately, Java does not have neither call by reference nor multiple return values.)- Parameters:
value- String containing the data to be parsed- Returns:
- resulting geometry for the parsed data
-
parse
Parse a binary encoded geometry. Is synchronized to protect offset counter. (Unfortunately, Java does not have neither call by reference nor multiple return values.)- Parameters:
value- byte array containing the data to be parsed- Returns:
- resulting geometry for the parsed data
-
parseGeometry
Parse a geometry starting at offset.- Parameters:
data- ValueGetter with the data to be parsed- Returns:
- the parsed geometry
-