Class DB2WKBWriter


  • public class DB2WKBWriter
    extends Object
    Author:
    Christian Mueller

    Version of JTS WKB Writer adjusted for DB2

    See Also:
    for JTS Java Doc
    • Constructor Summary

      Constructors 
      Constructor Description
      DB2WKBWriter​(boolean hasOGCWkbZTyps)
      Creates a writer that writes Geometry using BIG_ENDIAN byte order.
      DB2WKBWriter​(int byteOrder, boolean hasOGCWkbZTyps)
      Creates a writer that writes Geometrys in the given byte order If the input geometry has a small coordinate dimension, coordinates will be padded with NULL_ORDINATE.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static String bytesToHex​(byte[] bytes)  
      int getOutputDimension()  
      static int guessCoordinateDimension​(Geometry g)
      returns the coordinate dimension for a geometry
      byte[] write​(Geometry geom)
      Writes a Geometry into a byte array.
      void write​(Geometry geom, OutStream os)
      Writes a Geometry to an OutStream.
      • Methods inherited from class Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • DB2WKBWriter

        public DB2WKBWriter​(boolean hasOGCWkbZTyps)
        Creates a writer that writes Geometry using BIG_ENDIAN byte order. If the input geometry has a small coordinate dimension, coordinates will be padded with NULL_ORDINATE.
      • DB2WKBWriter

        public DB2WKBWriter​(int byteOrder,
                            boolean hasOGCWkbZTyps)
        Creates a writer that writes Geometrys in the given byte order If the input geometry has a small coordinate dimension, coordinates will be padded with NULL_ORDINATE.
        Parameters:
        byteOrder - the byte ordering to use
    • Method Detail

      • guessCoordinateDimension

        public static final int guessCoordinateDimension​(Geometry g)
        returns the coordinate dimension for a geometry
        Parameters:
        g - the geometry
        Returns:
        if there is one z value != NaN, then 3 else 2
      • bytesToHex

        public static String bytesToHex​(byte[] bytes)
      • write

        public byte[] write​(Geometry geom)
        Writes a Geometry into a byte array.
        Parameters:
        geom - the geometry to write
        Returns:
        the byte array containing the WKB
      • write

        public void write​(Geometry geom,
                          OutStream os)
                   throws IOException
        Writes a Geometry to an OutStream.
        Parameters:
        geom - the geometry to write
        os - the out stream to write to
        Throws:
        IOException - if an I/O error occurs
      • getOutputDimension

        public int getOutputDimension()