Class Wkb


  • public class Wkb
    extends Object
    Creates encoders/decoders for WKB geometry representations.

    Note that the WkbEncoder/WkbDecoder instances returned by the factory methods are not thread-safe.

    Author:
    Karel Maesen, Geovise BVBA creation-date: Oct 29, 2010
    • Constructor Detail

      • Wkb

        public Wkb()
    • Method Detail

      • toWkb

        public static ByteBuffer toWkb​(Geometry geometry)
        Encodes a Geometry into a WKB representation using the NDR (little-endian) byte-order.

        This methods uses the default WKB dialect (Postgis v1.5 EWKB ).

        Parameters:
        geometry - The Geometry to be encoded as WKB.
        Returns:
        A buffer of bytes that contains the WKB-encoded Geometry.
      • toWkb

        public static ByteBuffer toWkb​(Geometry<?> geometry,
                                       ByteOrder byteOrder)
        Encodes a Geometry into a WKB representation using the specified byte-order.

        This methods uses the default WKB dialect (Postgis v1.5 EWKB ).

        Parameters:
        geometry - The Geometry to be encoded as WKB.
        byteOrder - The WKB byte order, either XDR or NDR
        Returns:
        A buffer of bytes that contains the WKB-encoded Geometry.
      • fromWkb

        public static Geometry<?> fromWkb​(ByteBuffer byteBuffer)
        Decodes a WKB representation in a ByteBuffer to a Geometry.

        This methods uses the default WKB dialect (Postgis v1.5 EWKB ).

        Parameters:
        byteBuffer - A buffer of bytes that contains a WKB-encoded Geometry.
        Returns:
        The Geometry that is encoded in the WKB.
      • newDecoder

        public static WkbDecoder newDecoder​(Wkb.Dialect dialect)
        Creates a WkbDecoder for the specified WKB Dialect.
        Parameters:
        dialect - the WKB dialect
        Returns:
        an WkbDecoder that supports the specified dialect
      • newDecoder

        public static WkbDecoder newDecoder()
        Creates a WkbDecoder for the default WKB Dialect.
        Returns:
        an WkbDecoder that supports the specified dialect
      • newEncoder

        public static WkbEncoder newEncoder​(Wkb.Dialect dialect)
        Creates a WkbEncoder for the specified WKB Dialect.
        Parameters:
        dialect - the WKB dialect
        Returns:
        an WkbEncoder that supports the specified dialect
      • newEncoder

        public static WkbEncoder newEncoder()
        Creates a WkbEncoder for the default WKB Dialect.
        Returns:
        an WkbEncoder that supports the specified dialect