Package org.geolatte.geom.codec
Class Wkb
- java.lang.Object
-
- org.geolatte.geom.codec.Wkb
-
public class Wkb extends Object
Creates encoders/decoders for WKB geometry representations.Note that the
WkbEncoder /WkbDecoderinstances returned by the factory methods are not thread-safe.- Author:
- Karel Maesen, Geovise BVBA creation-date: Oct 29, 2010
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classWkb.Dialect
-
Constructor Summary
Constructors Constructor Description Wkb()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Geometry<?>fromWkb(ByteBuffer byteBuffer)Decodes a WKB representation in aByteBufferto aGeometry.static WkbDecodernewDecoder()Creates aWkbDecoderfor the default WKBDialect.static WkbDecodernewDecoder(Wkb.Dialect dialect)Creates aWkbDecoderfor the specified WKBDialect.static WkbEncodernewEncoder()Creates aWkbEncoderfor the default WKBDialect.static WkbEncodernewEncoder(Wkb.Dialect dialect)Creates aWkbEncoderfor the specified WKBDialect.static ByteBuffertoWkb(Geometry geometry)Encodes aGeometryinto a WKB representation using the NDR (little-endian) byte-order.static ByteBuffertoWkb(Geometry<?> geometry, ByteOrder byteOrder)Encodes aGeometryinto a WKB representation using the specified byte-order.
-
-
-
Method Detail
-
toWkb
public static ByteBuffer toWkb(Geometry geometry)
Encodes aGeometryinto a WKB representation using the NDR (little-endian) byte-order.This methods uses the default WKB dialect (Postgis v1.5 EWKB ).
- Parameters:
geometry- TheGeometryto 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 aGeometryinto a WKB representation using the specified byte-order.This methods uses the default WKB dialect (Postgis v1.5 EWKB ).
-
fromWkb
public static Geometry<?> fromWkb(ByteBuffer byteBuffer)
Decodes a WKB representation in aByteBufferto aGeometry.This methods uses the default WKB dialect (Postgis v1.5 EWKB ).
- Parameters:
byteBuffer- A buffer of bytes that contains a WKB-encodedGeometry.- Returns:
- The
Geometrythat is encoded in the WKB.
-
newDecoder
public static WkbDecoder newDecoder(Wkb.Dialect dialect)
Creates aWkbDecoderfor the specified WKBDialect.- Parameters:
dialect- the WKB dialect- Returns:
- an
WkbDecoderthat supports the specified dialect
-
newDecoder
public static WkbDecoder newDecoder()
Creates aWkbDecoderfor the default WKBDialect.- Returns:
- an
WkbDecoderthat supports the specified dialect
-
newEncoder
public static WkbEncoder newEncoder(Wkb.Dialect dialect)
Creates aWkbEncoderfor the specified WKBDialect.- Parameters:
dialect- the WKB dialect- Returns:
- an
WkbEncoderthat supports the specified dialect
-
newEncoder
public static WkbEncoder newEncoder()
Creates aWkbEncoderfor the default WKBDialect.- Returns:
- an
WkbEncoderthat supports the specified dialect
-
-