Package io.debezium.spatial
Class GeometryBytes
java.lang.Object
io.debezium.spatial.GeometryBytes
A simple geometry bytes helper class to handle operating on WKB (Well-Known Binary) and EWKB
(Extended Well-Known Binary) formats used to represent spatial geometry.
- Author:
- Chris Cranford
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) static classUtility visitor that checks if theGEOMETRYCOLLECTIONis empty. -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionGeometryBytes(byte[] ewkb) Create a geometry with a given Extended Well-Known Binary (EWKB) format byte array.GeometryBytes(byte[] wkb, Integer srid) Create a geometry with a given byte array and an optional spatial reference identifier. -
Method Summary
Modifier and TypeMethodDescriptionReturns a new geometry instance using big endian byte order.Provides a geometry instance that uses EWKB format.Returns a new geometry instance using little endian byte order.asWkb()Provides a geometry instance that uses WKB format.booleanbyte[]getBytes()Get the raw geometry bytes.getSrid()Get the spatial reference identifier.inthashCode()booleanReturns whether the geometry represent a geometry collection that has no geometry elements.booleanReturns whether the geometry bytes using the Extended Well-Known Binary (EWKB) format.Swaps coordinates by limiting the swap toGeometryCoordinateSwapper.DEFAULT_SWAP_SRIDS.Swaps coordinates regardless of spatial reference identifiers.toString()
-
Field Details
-
wkb
private final byte[] wkb -
srid
-
-
Constructor Details
-
GeometryBytes
Create a geometry with a given byte array and an optional spatial reference identifier.- Parameters:
wkb- byte array, must not benullsrid- spatial reference identifier, can benull
-
GeometryBytes
public GeometryBytes(byte[] ewkb) Create a geometry with a given Extended Well-Known Binary (EWKB) format byte array. The SRID is decoded from the provided byte array.- Parameters:
ewkb- byte array, must not benull
-
-
Method Details
-
getBytes
public byte[] getBytes()Get the raw geometry bytes.- Returns:
- geometry byte array, never
null
-
getSrid
Get the spatial reference identifier.- Returns:
- spatial reference identifier, may be
null
-
isExtended
public boolean isExtended()Returns whether the geometry bytes using the Extended Well-Known Binary (EWKB) format. -
isEmptyGeometryCollection
public boolean isEmptyGeometryCollection()Returns whether the geometry represent a geometry collection that has no geometry elements. -
swapCoordinates
Swaps coordinates by limiting the swap toGeometryCoordinateSwapper.DEFAULT_SWAP_SRIDS.- Returns:
- a new geometry instance that may or may not have its coordinated swapped.
-
swapCoordinatesNoCheck
Swaps coordinates regardless of spatial reference identifiers.- Returns:
- a geometry instance with the coordinates swapped
-
asExtendedWkb
Provides a geometry instance that uses EWKB format. If the current instance is already in EWKB format, the method returns the same instance. -
asWkb
Provides a geometry instance that uses WKB format. If the current instance is already in WKB format, the method returns the same instance. -
asLittleEndian
Returns a new geometry instance using little endian byte order. -
asBigEndian
Returns a new geometry instance using big endian byte order. -
equals
-
hashCode
public int hashCode() -
toString
-