Class WKBReader



  • public class WKBReader
    extends Object
    Reads a Geometryfrom a byte stream in Well-Known Binary format. Supports use of an InStream, which allows easy use with arbitary byte stream sources.

    This class reads the format describe in WKBWriter. It also partiually handles the Extended WKB format used by PostGIS, by parsing and storing SRID values.

    This class is designed to support reuse of a single instance to read multiple geometries. This class is not thread-safe; each thread should create its own instance.

    See Also:
    WKBWriter
    • Constructor Detail

      • WKBReader

        public WKBReader()
    • Method Detail

      • hexToBytes

        public static byte[] hexToBytes(String hex)
        Converts a hexadecimal string to a byte array. The hexadecimal digit symbols are case-insensitive.
        Parameters:
        hex - a string containing hex digits
        Returns:
        an array of bytes with the value of the hex string
      • read

        public Geometry read(byte[] bytes)
                      throws ParseException
        Reads a single Geometry in WKB format from a byte array.
        Parameters:
        bytes - the byte array to read from
        Returns:
        the geometry read
        Throws:
        ParseException - if the WKB is ill-formed